Skip to content

Commit 550f198

Browse files
committed
Removed NPD JRA55v1 catalogs & added NPD ERA5v1 domain_cfg, mesh_mask and subbasin Icechunk repos.
1 parent 8691635 commit 550f198

1 file changed

Lines changed: 7 additions & 100 deletions

File tree

catalogs/create_noc_stac.py

Lines changed: 7 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def create_item_with_asset(ds: xr.Dataset,
5353
"""
5454
# Define the item description based on the prefix:
5555
if 'domain' in prefix:
56-
description = f"Icechunk repository containin {config} global ocean model domain variables."
56+
description = f"Icechunk repository containing {config} global ocean model {prefix.split('/')[-1]} variables."
5757
elif 'I' in prefix:
5858
description = f"Icechunk repository containing {config} global sea-ice {operation} outputs defined at T-points."
5959
elif 'S' in prefix:
@@ -165,18 +165,6 @@ def create_item_with_asset(ds: xr.Dataset,
165165
)
166166

167167
# -- Define NOC Near-Present Day Model Configuration Catalogs -- #
168-
npd_eorca1_jra55v1 = pystac.Catalog(
169-
id="noc-npd/npd_eorca1_jra55v1",
170-
title="eORCA1 JRA55v1 NPD Catalog",
171-
description="Catalog of outputs from the eORCA1 JRA55-do version 1 Near-Present Day ocean physics simulation performed by the National Oceanography Centre."
172-
)
173-
174-
npd_eorca025_jra55v1 = pystac.Catalog(
175-
id="noc-npd/npd-eorca025-jra55v1",
176-
title="eORCA025 JRA55v1 NPD Catalog",
177-
description="Catalog of outputs from the eORCA025 JRA55-do version 1 Near-Present Day ocean physics simulation performed by the National Oceanography Centre.",
178-
)
179-
180168
npd_eorca1_era5v1 = pystac.Catalog(
181169
id="noc-npd/npd-eorca1-era5v1",
182170
title="eORCA1 ERA5v1 NPD Catalog",
@@ -199,18 +187,6 @@ def create_item_with_asset(ds: xr.Dataset,
199187
# Note: Options for platforms are: "gn_global", "gr_global", "gn_regional{1...4}", "gr_regional{1...4}", "tn", "tr".
200188
# where gn = global native model grids, gr = global regridded grids, tn = transects on native model grids, tr = transects on regridded grids.
201189

202-
gn_eorca1_jra55v1 = pystac.Catalog(
203-
id="noc-npd/npd-eorca1-jra55v1/gn_global",
204-
title="eORCA1 JRA55v1 NPD global native model grid Catalog",
205-
description="Catalog of global ocean physics outputs stored on the native eORCA1 curvilinear model grid."
206-
)
207-
208-
gn_eorca025_jra55v1 = pystac.Catalog(
209-
id="noc-npd/npd-eorca025-jra55v1/gn_global",
210-
title="eORCA025 JRA55v1 NPD global native model grid Catalog",
211-
description="Catalog of global ocean physics outputs stored on the native eORCA025 curvilinear model grid."
212-
)
213-
214190
gn_eorca1_era5v1 = pystac.Catalog(
215191
id="noc-npd/npd-eorca1-era5v1/gn_global",
216192
title="eORCA1 ERA5v1 NPD global native model grid Catalog",
@@ -229,77 +205,11 @@ def create_item_with_asset(ds: xr.Dataset,
229205
description="Catalog of global ocean physics outputs stored on the native eORCA12 curvilinear model grid."
230206
)
231207

232-
# -- Add Items to NOC Near-Present Day eORCA1 JRA55v1 Sub-Catalog -- #
233-
# Define the store credentials for the eORCA1 JRA55v1 NPD data:
234-
for prefix in ["T1y", "U1y", "V1y", "W1y", "I1y", "S1y", "T1m", "U1m", "V1m", "W1m", "I1m", "S1m", "domain"]:
235-
# Define url for eORCA1 JRA55v1 NPD data:
236-
bucket="npd-eorca1-jra55v1"
237-
endpoint_url="https://noc-msm-o.s3-ext.jc.rl.ac.uk"
238-
239-
# Open dataset from Icechunk repository:
240-
ds = xr.open_zarr(f"{endpoint_url}/{bucket}/{prefix}", consolidated=True)
241-
242-
# Create item with asset for each eORCA1 JRA55v1 NPD prefix:
243-
if 'domain' in prefix:
244-
operation = "None None"
245-
elif '1y' in prefix:
246-
operation = "annual mean"
247-
elif '1m' in prefix:
248-
operation = "monthly mean"
249-
elif '5d' in prefix:
250-
operation = "5-day mean"
251-
252-
item = create_item_with_asset(
253-
ds=ds,
254-
bucket="npd-eorca1-jra55v1",
255-
platform="gn_global",
256-
prefix=prefix,
257-
config="eORCA1 JRA55v1 NPD",
258-
operation=operation,
259-
media_type="application/vnd+zarr"
260-
)
261-
# Add item to the eORCA1 JRA55v1 NPD global native model grid catalog:
262-
gn_eorca1_jra55v1.add_item(item)
263-
264-
# -- Add Items to NOC Near-Present Day eORCA025 JRA55v1 Sub-Catalog -- #
265-
# Define the store credentials for the eORCA025 JRA55v1 NPD data:
266-
for prefix in ["T1y_3d", "T1y_4d", "U1y_3d", "U1y_4d", "V1y_3d", "V1y_4d", "W1y_4d", "I1y_3d", "S1y_1d",
267-
"T1m_3d", "T1m_4d", "U1m_3d", "U1m_4d", "V1m_3d", "V1m_4d", "W1m_4d", "I1m_3d", "S1m_1d",
268-
"T5d_3d", "T5d_4d", "U5d_3d", "U5d_4d", "V5d_3d", "V5d_4d", "I5d_3d", "S5d_1d", "domain"
269-
]:
270-
# Define url for eORCA025 JRA55v1 NPD data:
271-
bucket="npd-eorca1-jra55v1"
272-
endpoint_url="https://noc-msm-o.s3-ext.jc.rl.ac.uk"
273-
274-
# Open dataset from Icechunk repository:
275-
ds = xr.open_zarr(f"{endpoint_url}/{bucket}/{prefix}", consolidated=True)
276-
277-
# Create item with asset for each eORCA025 JRA55v1 NPD prefix:
278-
if 'domain' in prefix:
279-
operation = "None None"
280-
elif '1y' in prefix:
281-
operation = "annual mean"
282-
elif '1m' in prefix:
283-
operation = "monthly mean"
284-
elif '5d' in prefix:
285-
operation = "5-day mean"
286-
287-
item = create_item_with_asset(
288-
ds=ds,
289-
bucket="npd-eorca025-jra55v1",
290-
platform="gn_global",
291-
prefix=prefix,
292-
config="eORCA025 JRA55v1 NPD",
293-
operation=operation,
294-
media_type="application/vnd+zarr"
295-
)
296-
# Add item to the eORCA025 JRA55v1 NPD global native model grid catalog:
297-
gn_eorca025_jra55v1.add_item(item)
298-
299-
300208
# -- Add Items to NOC Near-Present Day eORCA1 ERA5v1 Sub-Catalog -- #
301209
# Define the store credentials for the eORCA1 ERA5v1 NPD data:
302-
for prefix in ["T1y", "U1y", "V1y", "W1y", "I1y", "S1y", "T1m", "U1m", "V1m", "W1m", "I1m", "S1m", "domain"]:
210+
for prefix in ["T1y", "U1y", "V1y", "W1y", "I1y", "S1y", "T1m", "U1m", "V1m", "W1m", "I1m", "S1m",
211+
"domain/domain_cfg", "domain/mesh_mask", "domain/subbasins"
212+
]:
303213
# Define S3 storage to read eORCA1 ERA5v1 NPD data:
304214
storage = icechunk.s3_storage(
305215
bucket="npd-eorca1-era5v1",
@@ -339,7 +249,8 @@ def create_item_with_asset(ds: xr.Dataset,
339249
# Define the store credentials for the eORCA025 ERA5v1 NPD data:
340250
for prefix in ["T1y_3d", "T1y_4d", "U1y_3d", "U1y_4d", "V1y_3d", "V1y_4d", "W1y_4d", "I1y_3d", "S1y_1d",
341251
"T1m_3d", "T1m_4d", "U1m_3d", "U1m_4d", "V1m_3d", "V1m_4d", "W1m_4d", "I1m_3d", "S1m_1d",
342-
"T5d_3d", "T5d_4d", "U5d_3d", "U5d_4d", "V5d_3d", "V5d_4d", "I5d_3d", "S5d_1d", "domain"
252+
"T5d_3d", "T5d_4d", "U5d_3d", "U5d_4d", "V5d_3d", "V5d_4d", "I5d_3d", "S5d_1d",
253+
"domain/domain_cfg", "domain/mesh_mask", "domain/subbasins"
343254
]:
344255
# Define S3 storage to read eORCA025 ERA5v1 NPD data:
345256
storage = icechunk.s3_storage(
@@ -380,7 +291,7 @@ def create_item_with_asset(ds: xr.Dataset,
380291
# Define the store credentials for the eORCA12 ERA5v1 NPD data:
381292
for prefix in ["T1y_3d", "T1y_4d", "U1y_3d", "U1y_4d", "V1y_3d", "V1y_4d", "W1y_4d", "I1y_3d", "S1y_1d",
382293
"T1m_3d", "T1m_4d", "U1m_3d", "U1m_4d", "V1m_3d", "V1m_4d", "W1m_4d", "I1m_3d", "S1m_1d",
383-
"domain",
294+
"domain/domain_cfg",
384295
]:
385296
# Define S3 storage to read eORCA12 ERA5v1 NPD data:
386297
storage = icechunk.s3_storage(
@@ -418,14 +329,10 @@ def create_item_with_asset(ds: xr.Dataset,
418329
gn_eorca12_era5v1.add_item(item)
419330

420331
# -- Add Catalogs to NOC Near-Present Day Collection -- #
421-
npd_eorca1_jra55v1.add_child(gn_eorca1_jra55v1)
422-
npd_eorca025_jra55v1.add_child(gn_eorca025_jra55v1)
423332
npd_eorca1_era5v1.add_child(gn_eorca1_era5v1)
424333
npd_eorca025_era5v1.add_child(gn_eorca025_era5v1)
425334
npd_eorca12_era5v1.add_child(gn_eorca12_era5v1)
426335

427-
npd_collection.add_child(npd_eorca1_jra55v1)
428-
npd_collection.add_child(npd_eorca025_jra55v1)
429336
npd_collection.add_child(npd_eorca1_era5v1)
430337
npd_collection.add_child(npd_eorca025_era5v1)
431338
npd_collection.add_child(npd_eorca12_era5v1)

0 commit comments

Comments
 (0)