-
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
Floodscan stats #11
Floodscan stats #11
Conversation
# Conflicts: # run_raster_stats.py # src/config/seas5.yml # src/config/settings.py # src/utils/cog_utils.py
Floodscan stats hannah
"""Test basic upsampling of a 2D dataset.""" | ||
target_res = 0.5 # Upsample from 1.0 to 0.5 degrees | ||
result = upsample_raster(simple_dataset, resampled_resolution=target_res) | ||
result = upsample_raster(dataset_with_time, resampled_resolution=target_res) |
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.
Ah good fix!
start_date: 2023-12-01 | ||
end_date: 2024-01-31 | ||
iso3s: ["ETH"] | ||
coverage: ["DZA", "AGO", "BEN", "BWA", "BFA", "BDI", "CPV", "CMR", "CAF", "TCD", "COM", "COG", "CIV", "CAP", "DJI", "EGY", "GNQ", "ERI", "SWZ", "ETH", "GAB", "GMB", "GHA", "GIN", "GNB", "KEN", "LS0", "LBR", "LBY", "MDG", "MWI", "MLI", "MRT", "MUS", "MAR", "MOZ", "NAM", "NER", "NGA", "RWA", "STP", "SEN", "SYC", "SLE", "SOM", "ZAF", "SSD", "SDN", "TGO", "TUN", "UGA", "TZA", "ZMB", "ZWE"] |
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.
Also a nice way to do this!
dim = next(iter(extra_dim)) | ||
if extra_dim[dim] == "str": | ||
parsed_extra_dims[dim] = VARCHAR | ||
else: |
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.
In the future, we'll probably want to have other data types, but can leave as is for now
@@ -9,7 +9,7 @@ def cli_args(): | |||
parser.add_argument( | |||
"dataset", | |||
help="Dataset for which to calculate raster stats", | |||
choices=["seas5", "era5", "imerg"], | |||
choices=["seas5", "era5", "imerg", "floodscan"], |
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.
Also as discussed, in the future it'd be good to think about how we can avoid the hard-coding of each dataset (since this happens in numerous places throughout the code). Although really more of a note for myself since I set it up this way...
|
||
for dataset in pipelines: | ||
config = load_pipeline_config(dataset) | ||
if "coverage" in config: |
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.
Would be worth adding at least a comment in here to remind ourselves that we're assuming that the coverage is specified in ISO3 values.
@isatotun looks good to merge to me! |
WIP to generate raster stats for new Floodscan COG outputs. Since the Floodscan COGs include bands for both SFED and MFED data, I've generalized a bunch of functionality initially developed to handle the SEAS5
leadtime
dimension. With these changes, the raster stats pipeline should be able to handle any generic 4th dimension (eg.band
orleadtime
) coming from the input data. To properly create the Postgres table, this dimension just needs to be specified in the dataset'sconfig.yml
file (see theextra_dims
property).To do:
floodscan
) to theiso3
table, which will tell us which ISO3s are covered. So any future datasets that have non-global coverage could get their own similar column.band
dimension. This is currently just being pulled from the source COG, where values are either 1 or 2. We need to map these toSFED
andMFED
so that the output table is more informative.