@@ -24,6 +24,7 @@ def create_item_with_asset(ds: xr.Dataset,
2424 prefix : str ,
2525 config : str = "eORCA1 ERA5v1 NPD" ,
2626 operation : str = "annual-mean" ,
27+ media_type : str = "application/icechunk" ,
2728 ) -> pystac .Item :
2829 """
2930 Create a STAC Item with an asset from an xarray Dataset.
@@ -42,6 +43,8 @@ def create_item_with_asset(ds: xr.Dataset,
4243 The configuration string for the dataset (default is "eORCA1 ERA5v1 NPD").
4344 operation : str, optional
4445 The operation string indicating the type of operation performed on the dataset (default is "annual-mean").
46+ media_type : str, optional
47+ Media type of the Item asset to be created. Options are 'application/icechunk' and 'application/vnd+zarr'.
4548
4649 Returns
4750 -------
@@ -99,7 +102,7 @@ def create_item_with_asset(ds: xr.Dataset,
99102 href = f"https://noc-msm-o.s3-ext.jc.rl.ac.uk/{ bucket } /{ platform } /{ prefix } " ,
100103 title = f"{ config } { prefix } Icechunk repository" ,
101104 description = description ,
102- media_type = "application/icechunk" ,
105+ media_type = media_type ,
103106 extra_fields = dict (
104107 bucket = bucket ,
105108 prefix = prefix ,
@@ -162,6 +165,18 @@ def create_item_with_asset(ds: xr.Dataset,
162165)
163166
164167# -- 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+
165180npd_eorca1_era5v1 = pystac .Catalog (
166181 id = "noc-npd/npd-eorca1-era5v1" ,
167182 title = "eORCA1 ERA5v1 NPD Catalog" ,
@@ -184,6 +199,18 @@ def create_item_with_asset(ds: xr.Dataset,
184199# Note: Options for platforms are: "gn_global", "gr_global", "gn_regional{1...4}", "gr_regional{1...4}", "tn", "tr".
185200# where gn = global native model grids, gr = global regridded grids, tn = transects on native model grids, tr = transects on regridded grids.
186201
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+
187214gn_eorca1_era5v1 = pystac .Catalog (
188215 id = "noc-npd/npd-eorca1-era5v1/gn_global" ,
189216 title = "eORCA1 ERA5v1 NPD global native model grid Catalog" ,
@@ -202,6 +229,74 @@ def create_item_with_asset(ds: xr.Dataset,
202229 description = "Catalog of global ocean physics outputs stored on the native eORCA12 curvilinear model grid."
203230 )
204231
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+
205300# -- Add Items to NOC Near-Present Day eORCA1 ERA5v1 Sub-Catalog -- #
206301# Define the store credentials for the eORCA1 ERA5v1 NPD data:
207302for prefix in ["T1y" , "U1y" , "V1y" , "W1y" , "I1y" , "S1y" , "T1m" , "U1m" , "V1m" , "W1m" , "I1m" , "S1m" , "domain" ]:
@@ -234,7 +329,8 @@ def create_item_with_asset(ds: xr.Dataset,
234329 platform = "gn_global" ,
235330 prefix = prefix ,
236331 config = "eORCA1 ERA5v1 NPD" ,
237- operation = operation
332+ operation = operation ,
333+ media_type = "application/icechunk"
238334 )
239335 # Add item to the eORCA1 ERA5v1 NPD global native model grid catalog:
240336 gn_eorca1_era5v1 .add_item (item )
@@ -274,7 +370,8 @@ def create_item_with_asset(ds: xr.Dataset,
274370 platform = "gn_global" ,
275371 prefix = prefix ,
276372 config = "eORCA025 ERA5v1 NPD" ,
277- operation = operation
373+ operation = operation ,
374+ media_type = "application/icechunk"
278375 )
279376 # Add item to the eORCA025 ERA5v1 NPD global native model grid catalog:
280377 gn_eorca025_era5v1 .add_item (item )
@@ -314,16 +411,21 @@ def create_item_with_asset(ds: xr.Dataset,
314411 platform = "gn_global" ,
315412 prefix = prefix ,
316413 config = "eORCA12 ERA5v1 NPD" ,
317- operation = operation
414+ operation = operation ,
415+ media_type = "application/icechunk"
318416 )
319417 # Add item to the eORCA12 ERA5v1 NPD global native model grid catalog:
320418 gn_eorca12_era5v1 .add_item (item )
321419
322420# -- 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 )
323423npd_eorca1_era5v1 .add_child (gn_eorca1_era5v1 )
324424npd_eorca025_era5v1 .add_child (gn_eorca025_era5v1 )
325425npd_eorca12_era5v1 .add_child (gn_eorca12_era5v1 )
326426
427+ npd_collection .add_child (npd_eorca1_jra55v1 )
428+ npd_collection .add_child (npd_eorca025_jra55v1 )
327429npd_collection .add_child (npd_eorca1_era5v1 )
328430npd_collection .add_child (npd_eorca025_era5v1 )
329431npd_collection .add_child (npd_eorca12_era5v1 )
0 commit comments