Skip to content

Commit

Permalink
Merge 2a19b5c into 8ab12c5
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion committed Jan 4, 2023
2 parents 8ab12c5 + 2a19b5c commit cb3b29e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions oggm/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2169,8 +2169,8 @@ def test_tandem(self):
fakefile='TDM1_DEM__30_N60W146.tif')

def down_check(url, *args, **kwargs):
expect = ('https://download.geoservice.dlr.de/TDM90/files/N60/' +
'W140/' + 'TDM1_DEM__30_N60W146.zip')
expect = ('https://download.geoservice.dlr.de/TDM90/files/DEM/'
'N60/W140/TDM1_DEM__30_N60W146.zip')
self.assertEqual(url, expect)
return tf

Expand Down Expand Up @@ -2202,7 +2202,7 @@ def down_check(url, *args, **kwargs):
file = tf.get(url.split('/')[-1])
self.assertIsNotNone(file)

expect = 'https://download.geoservice.dlr.de/TDM90/files/N60/W140/'
expect = 'https://download.geoservice.dlr.de/TDM90/files/DEM/N60/W140/'
expect += file.split('/')[-1].replace('tif', '.zip')
self.assertEqual(url, expect)

Expand Down
3 changes: 2 additions & 1 deletion oggm/utils/_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ def _download_tandem_file_unlocked(zone):
tmpdir = cfg.PATHS['tmp_dir']
mkdir(tmpdir)
bname = zone.split('/')[-1] + '_DEM.tif'
wwwfile = ('https://download.geoservice.dlr.de/TDM90/files/'
wwwfile = ('https://download.geoservice.dlr.de/TDM90/files/DEM/'
'{}.zip'.format(zone))
outpath = os.path.join(tmpdir, bname)

Expand Down Expand Up @@ -1387,6 +1387,7 @@ def srtm_zone(lon_ex, lat_ex):
def _tandem_path(lon_tile, lat_tile):

# OK we have a proper tile now
# This changed in December 2022

# First folder level is sorted from S to N
level_0 = 'S' if lat_tile < 0 else 'N'
Expand Down
11 changes: 5 additions & 6 deletions oggm/utils/_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2586,16 +2586,14 @@ def __init__(self, rgi_entity, base_dir=None, reset=False,
except AttributeError:
pass




try:
self.rgi_id = rgi_entity.rgi_id
self.glims_id = rgi_entity.glims_id
except AttributeError:
# RGI V6
self.rgi_id = rgi_entity.RGIId
self.glims_id = rgi_entity.GLIMSId

# Do we want to use the RGI center point or ours?
if cfg.PARAMS['use_rgi_area']:
try:
Expand Down Expand Up @@ -2639,7 +2637,6 @@ def __init__(self, rgi_entity, base_dir=None, reset=False,
# temporary default for RGI V7:
gtype = ['0', '0']


try:
gstatus = rgi_entity.RGIFlag[0]
except AttributeError:
Expand Down Expand Up @@ -2873,9 +2870,12 @@ def rgi_area_km2(self):
"""The glacier's RGI area (km2)."""
try:
_area = self.read_shapefile('outlines')['Area']
return np.round(float(_area), decimals=3)
except OSError:
raise RuntimeError('No outlines available')
except KeyError:
# RGI V7
_area = self.read_shapefile('outlines')['area_km2']
return np.round(float(_area), decimals=3)

@lazy_property
def intersects_ids(self):
Expand Down Expand Up @@ -3000,7 +3000,6 @@ def has_file(self, filename, filesuffix='', _deprecation_check=True):
if not out and (filename == 'climate_info'):
# Try pickle
out = os.path.exists(fp.replace('.json', '.pkl'))

return out

def _read_deprecated_climate_info(self):
Expand Down

0 comments on commit cb3b29e

Please sign in to comment.