OGGM / oggm

Open Global Glacier Model
http://oggm.org
BSD 3-Clause "New" or "Revised" License
218 stars 105 forks source link

How to update the "rgi62_dem_frac.h5" file when using a non-RGI glacier inventory? #1269

Open Keeptg opened 3 years ago

Keeptg commented 3 years ago

Since version 1.4, OGGM automatically choosen the DEM source according rgi62_dem_frac.h5 file. This avoid the using of bad DEM in OGGM as much as possible.

While the default rgi62_dem_frac.h5 file only support RGI glacier inventory. For the using of custom glacier inventory (modified using utils.cook_rgidf()), the rgi62_dem_frac.h5 file might return wrong information (the mismatch between modified glacier inventory and the real RGI) or errors (if the glacier number of the custom glacier inventory are more than that in RGI for a RGI region).

For my case, I'm running the prepro_levels script (modified from oggm.cli.prepro_levels.py) based on the updated GAMDAM, and I got KeyError for all of the glaciers with RGI id behind RGI60-13.54431 (the last RGI id in the real RGI60 for the region 13).

Instead of using preprocessed rgi62_dem_frac.h5, I'm wondering if it's possible that OGGM can do this part of job in the real time? Or how can I update rgi62_dem_frac.h5 to make sure OGGM work well under the driven of updated GAMDAM?

fmaussion commented 3 years ago

Thanks for asking. I think that when I implemented this I thought that custom inventories should specify their DEM sources explicitly as per the tutorial: https://oggm.org/tutorials/stable/notebooks/dem_sources.html#choose-a-dem-source-e-g-srtm

fmaussion commented 3 years ago

Other ideas welcome!

Keeptg commented 3 years ago

Other ideas welcome!

How did you generate the rgi62_dem_frac.h5 file? Do you think it is possible to add an argument that could make OGGM calculate the fraction and decide which dem should be used during execute define_glacier_region() function? It will be great if the rgi62_dem_frac.h5 file or like this can be generated during executing prepro_levels procedure.

fmaussion commented 3 years ago

rgi62_dem_frac.h5 was generated based on RGI-TOPO https://rgitools.readthedocs.io/en/latest/dems.html

You need to download and process all DEMs to generate this file, which is overkill for this purpose in my opinion. Taking your use case as an example, all glaciers in HMA fit within the NASA dataset, so that it's much faster to just set it manually!

Keeptg commented 3 years ago

You need to download and process all DEMs to generate this file, which is overkill for this purpose in my opinion.

Thanks for the information! Yes, if it need to download all DEMs to generate this file, then set the dem source is a better solution than that!

fmaussion commented 3 years ago

However this question reveals a bigger problem with the current way we choose DEM with this rgi62_dem_frac.h5 file. This assumes that we are really working with the RGI, which is not true when people trick OGGM into believing to use the RGI.

The previous way to choose DEMs (based on glacier location) was less accurate but more robust and should probably become the default again.

Keeptg commented 3 years ago

This assumes that we are really working with the RGI, which is not true when people trick OGGM into believing to use the RGI.

Yes, this is why I wondering if it's possible of calculating the rgi62_dem_frac.h5 in the tasks.define_glacier_region() function or at least in during the processing of prepro level data.

The previous way to choose DEMs (based on glacier location) was less accurate but more robust and should probably become the default again.

Compared with the old one, the current way is more accurte. I agree with making both of the two methods usable in OGGM, but tend to keep the current way as the default , and introduce the other choice in the tutorials or documents.