-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create impervious_surface.py #66
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
31c3b49
Create impervious_surface.py
tedw0ng b4c5860
force image dataset to iagecollection
tedw0ng 3b0ca2f
added test for impervious surface
tedw0ng b67463a
fix indent
tedw0ng d399adb
fix indent
tedw0ng e4bbc23
tabs to spaces
tedw0ng 00fa774
add class to __init__
tedw0ng 4f82253
Update test_layers.py
tedw0ng c85058c
Update test_layers.py
tedw0ng f247f8d
Update test_layers.py
tedw0ng 4867cfa
Merge branch 'main' into add_impervious_surface_layer
chrowe f4745b8
Use BBOX for test
chrowe 4a169d9
Merge branch 'main' into add_impervious_surface_layer
weiqi-tori File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from dask.diagnostics import ProgressBar | ||
import xarray as xr | ||
import xee | ||
import ee | ||
|
||
from .layer import Layer, get_utm_zone_epsg, get_image_collection | ||
|
||
|
||
class ImperviousSurface(Layer): | ||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
|
||
def get_data(self, bbox): | ||
# load impervious_surface | ||
dataset = ee.ImageCollection(ee.Image("Tsinghua/FROM-GLC/GAIA/v10").gt(0)) # change_year_index is zero if permeable as of 2018 | ||
imperv_surf = ee.ImageCollection(dataset | ||
.filterBounds(ee.Geometry.BBox(*bbox)) | ||
.select('change_year_index') | ||
.sum() | ||
) | ||
|
||
data = get_image_collection(imperv_surf, bbox, 100, "imperv surf") | ||
return data.change_year_index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dataset
needs to be forced to ImageCollection to apply thefilterBounds()
and other functions.AttributeError: 'Image' object has no attribute 'filterBounds'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forced dataset to be imagecollection, and added test for impervious surface. (Not 100% sure I did that right.)