-
Notifications
You must be signed in to change notification settings - Fork 105
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
Merge gridded data #1674
Merge gridded data #1674
Conversation
… of it for the new function 'dem_for_combined_grid'
…e_glaciers # Conflicts: # oggm/core/gis.py
…hickness, and some more adaptations
… merge_gridded_data, added test_merge_simulated_thickness
Hello @pat-schmitt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2024-02-27 13:42:41 UTC |
@pat-schmitt also thanks from my side for the constant feedback! |
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 a lot for this! Interesting use of unwrapped - I'm pretty sure this is not how it should be done but that's more my problem, not yours. This is looking good I think. To be tested fully requires a global prepro run. We might do one soon enough, but not right now 😅
Feel free to merge @pat-schmitt
…schmitt/oggm into visualize_multiple_glaciers
…lel for saving memory, tests are also included
It looks like google updated their images. @fmaussion should I update the image inside of this PR or in a new one? (We also could increase the compare tolerance from 25 to 26 to pass again, I do not know how frequent this updates are...) |
The new image is much worse 🙄 - please increase tolerance for now, thanks! |
@patrick I have a very specific questions about the functionality of |
No there is currently no function available for doing this out of the box. However, this could be implemented more or less straightforward by adapting |
This PR is a combined effort of @afisc and myself. The main new functionality is a function for merging gridded_data from several gdirs onto a new 'combined'-grid and optionally adding topography information from a DEM to the new grid.
Changes in
oggm.core.gis
:We had to touch some sensible lines of code here (need a thorough review). Even though it looks like we changed a lot, we mainly outsourced some functionalities from
define_glacier_region
to reduce code duplication (I think the names are self-explaining):check_dem_source
,reproject_dem
andget_dem_for_grid
. We tried to add a few tests for the new functionalities (intest_prepro
), but it is a good sign that all existing tests which usedefine_glacier_region
are not failing (including the graphical tests).Further, we adopted
process_dem
,read_geotiff_dem
andGriddedNcdFile
to work with gdir (old behaviour) or you can provide a grid with a filepath.We added a new entity task
reproject_gridded_data_variable_to_grid
, which is called byworkflow.merge_gridded_data
(see below) for potential multiprocessingChanges in
utils
:combine_grids
fromgraphics
toutils
entity_task
we added an.unwrapped
method, which can be used to execute an entity_task without the overhead. Because this overhead needs a valid gdir and to reduce code duplication we want to use some code with a grid instead of a gdir (e.g.process_dem
)Changes in
workflow
:merge_gridded_data
: can take gridded data of multiple gdirs, define a new 'combined'-grid and reprojects the data onto this new grid. The function can preserves totals (e.g. volume). Optionally you also could add topography from DEM to that new grid. Finally, the function could take data from different gridded_data-files and merge it (useful for 'distributed'-simulations, see below).test_merge_gridded_data
totest_workflow
Changes in
sandbox.distribute_2d
:merge_simulated_thickness
: this function is more or less a wrapper formerge_gridded_data
and combines all data which could be useful for visualisation fromgridded_data
andgridded_simulation
(this file is created during the redistribution of flowline-data back to the grid). It adds a topography from a DEM and recalculates the bed-topography, using the reprojected thickness after inversion.distributed_thickness
ingridded_simulation
tosimulated_thickness
to avoid confusion withdistribued_thickness
ingridded_data
(which is the thickness after inversion). Alternatively, we can usedistributed_inversion_thickness
. Any preferences? This needs to be adapted in the tutorials.test_merge_simulated_thickness
totest_models
I will work on a tutorial of this new functionality in the next weeks!
I hope I have not forgotten something :). And thanks again @afisc for your help!
merge_gridded_data
distributed_thickness
tosimulated_thickness
in tutorials (if we decide to stick with this name convention)extend_plot_limit=True
in plotting functions fromgraphics
)whats-new.rst