Skip to content

Commit 6857e50

Browse files
committed
Also fix geotop-url
And allow the user to change nlmod.read.geotop.GEOTOP_URL
1 parent d1c1cc4 commit 6857e50

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

nlmod/read/geotop.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
logger = logging.getLogger(__name__)
1515

16-
GEOTOP_URL = "https://dinodata.nl/opendap/GeoTOP/geotop.nc"
16+
GEOTOP_URL = "https://www.dinodata.nl/opendap/GeoTOP/geotop.nc"
1717

1818

1919
def get_lithok_props(rgb_colors=True):
@@ -263,7 +263,7 @@ def get_geotop(*args, **kwargs):
263263
extent : list, tuple or np.array
264264
desired model extent (xmin, xmax, ymin, ymax)
265265
url : str, optional
266-
url of geotop netcdf file. The default is
266+
url of geotop netcdf file. The default is nlmod.read.geotop.GEOTOP_URL:
267267
http://www.dinodata.nl/opendap/GeoTOP/geotop.nc
268268
probabilities : bool, optional
269269
if True, also download probability data. The default is False.
@@ -282,7 +282,7 @@ def get_geotop(*args, **kwargs):
282282

283283

284284
@cache.cache_netcdf()
285-
def download_geotop(extent, url=GEOTOP_URL, probabilities=False, chunks="auto"):
285+
def download_geotop(extent, url=None, probabilities=False, chunks="auto"):
286286
"""Get a slice of the geotop netcdf url within the extent, set the x and y
287287
coordinates to match the cell centers and keep only the strat and lithok data
288288
variables.
@@ -292,7 +292,7 @@ def download_geotop(extent, url=GEOTOP_URL, probabilities=False, chunks="auto"):
292292
extent : list, tuple or np.array
293293
desired model extent (xmin, xmax, ymin, ymax)
294294
url : str, optional
295-
url of geotop netcdf file. The default is
295+
url of geotop netcdf file. The default is nlmod.read.geotop.GEOTOP_URL:
296296
http://www.dinodata.nl/opendap/GeoTOP/geotop.nc
297297
probabilities : bool, optional
298298
if True, also download probability data. The default is False.
@@ -312,6 +312,8 @@ def download_geotop(extent, url=GEOTOP_URL, probabilities=False, chunks="auto"):
312312
gt : xarray Dataset
313313
slices geotop netcdf.
314314
"""
315+
if url is None:
316+
url = GEOTOP_URL
315317
gt = xr.open_dataset(url, chunks=chunks)
316318

317319
# only download requisite data

0 commit comments

Comments
 (0)