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
Add cook_rgidf()
to pretend non-RGI with RGI format
#1251
Conversation
Not sure what's the reason the test program failed. Any suggestions wil be appriciated! |
The tests fail because the test requires to download input data which is not in the test data, a situation we try to avoid. I think we don't need to test that everything works in your tests, let me have a look at your code later today. |
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.
Thanks! This is looking good. Some minor suggestions to the names, otherwise this looks good!
rgidf = utils.cook_rgidf(cgidf, save_special_columns={'Glc_Long': 'CenLon', | ||
'Glc_Lati': 'CenLat'}, | ||
assign_col_values={'Area': cgidf.Glc_Area*1e-6}) | ||
gdirs = workflow.init_glacier_directories(rgidf) |
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.
Yes so I think you need to stop the test here, and ensure that OGGM could still create the glacier directories properly (that's the main test anyway)
oggm/utils/_funcs.py
Outdated
the GeoDataFrame of the user's glacier inventory | ||
region : str | ||
Glacier RGI region code, only usable when set `confirm_region=False`. | ||
The default is '13'. |
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.
There should be no default here - it should fail if the region is not provided and cannot be inferred automatically
oggm/utils/_funcs.py
Outdated
Glacier RGI region code, only usable when set `confirm_region=False`. | ||
The default is '13'. | ||
version : str | ||
Glacier inventory version code. The default is '60'. |
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.
Explain that this is necessary to generate the RGI Ids
oggm/utils/_funcs.py
Outdated
|
||
# If there are specifical column in the original glacier inventory we want to keep | ||
if save_special_columns is not None: | ||
for col in save_special_columns.keys(): |
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.
loop like:
for key, val in dict.items()
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.
Thanks! Didn't know this before.
oggm/utils/_funcs.py
Outdated
following the glacier order. | ||
id_suffix : str or None | ||
Add a suffix to the glacier id. The default is None, no suffix | ||
save_special_columns : dict or None |
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.
could this be only one argument (assign_col_values
) where the right column name in the RGI format is already used? The users can change the name themselves if they want to, I'm not sure this dict here is very useful.
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.
OK! assign_col_values
argument was deleted!
There are still two error reported. |
Thanks @Keeptg ! sorry this took so long, excellent work! |
I add a function
cook_rgidf()
inutils._funcs
to make it easier of using a non-RGI glacier inventory in OGGM.Will add a tutorial to show how it can be used in future!
whats-new.rst