OceanDataStore 0.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. OceanDataStore/__init__.py +21 -0
  2. OceanDataStore/catalog/__init__.py +12 -0
  3. OceanDataStore/catalog/oceandatacatalog.py +1242 -0
  4. OceanDataStore/catalog/stac/README.md +34 -0
  5. OceanDataStore/catalog/stac/__init__.py +30 -0
  6. OceanDataStore/catalog/stac/create_noc_stac.py +109 -0
  7. OceanDataStore/catalog/stac/npd_era5_collection.py +364 -0
  8. OceanDataStore/catalog/stac/npd_jra55_collection.py +196 -0
  9. OceanDataStore/catalog/stac/ods_obs_collection.py +534 -0
  10. OceanDataStore/catalog/stac/rapid_evo_collection.py +309 -0
  11. OceanDataStore/catalog/stac/template_collection.py +85 -0
  12. OceanDataStore/catalog/stac/utils.py +476 -0
  13. OceanDataStore/cli/__init__.py +34 -0
  14. OceanDataStore/cli/arg_parser.py +182 -0
  15. OceanDataStore/cli/cli.py +203 -0
  16. OceanDataStore/cli/exceptions.py +83 -0
  17. OceanDataStore/cli/icechunk.py +888 -0
  18. OceanDataStore/cli/logging.py +52 -0
  19. OceanDataStore/cli/object_store.py +293 -0
  20. OceanDataStore/cli/utils.py +275 -0
  21. OceanDataStore/cli/zarr.py +870 -0
  22. OceanDataStore/data/ARMOR3D/create_ARMOR3D_P1M-m_monthly_climatology.py +135 -0
  23. OceanDataStore/data/ARMOR3D/download_ARMOR3D_0.125def_P1M-m_1993_2024.py +33 -0
  24. OceanDataStore/data/ARMOR3D/run_create_ARMOR3D_P1M-m_monthly_climatology.slurm +32 -0
  25. OceanDataStore/data/ARMOR3D/run_send_ARMOR3D_P1M-m_climatology_to_os.slurm +32 -0
  26. OceanDataStore/data/ARMOR3D/run_send_ARMOR3D_P1M-m_monthly_to_os.slurm +32 -0
  27. OceanDataStore/data/ARMOR3D/run_update_ARMOR3D_P1m-m_monthly_to_os.slurm +32 -0
  28. OceanDataStore/data/ARMOR3D/send_ARMOR3D_P1m-m_monthly_climatology_to_os.py +99 -0
  29. OceanDataStore/data/ARMOR3D/send_ARMOR3D_P1m-m_monthly_to_os.py +147 -0
  30. OceanDataStore/data/ARMOR3D/update_ARMOR3D_P1m-m_monthly_to_os.py +143 -0
  31. OceanDataStore/data/EN.4.2.2/create_EN4.2.2_analysis_g10_climatology.py +162 -0
  32. OceanDataStore/data/EN.4.2.2/download_EN4.2.2_analysis_g10_data.sh +51 -0
  33. OceanDataStore/data/EN.4.2.2/run_send_EN4.2.2_analysis_g10_climatology_to_os.slurm +32 -0
  34. OceanDataStore/data/EN.4.2.2/run_send_EN4.2.2_analysis_g10_monthly_to_os.slurm +32 -0
  35. OceanDataStore/data/EN.4.2.2/run_update_EN4.2.2_analysis_g10_monthly_to_os.slurm +32 -0
  36. OceanDataStore/data/EN.4.2.2/send_EN4.2.2_analysis_g10_monthly_climatology_to_os.py +76 -0
  37. OceanDataStore/data/EN.4.2.2/send_EN4.2.2_analysis_g10_monthly_to_os.py +165 -0
  38. OceanDataStore/data/EN.4.2.2/update_EN4.2.2_analysis_g10_monthly_to_os.py +161 -0
  39. OceanDataStore/data/ERA5/create_ERA5_daily_climatology.py +110 -0
  40. OceanDataStore/data/ERA5/create_ERA5_daily_mean.py +69 -0
  41. OceanDataStore/data/ERA5/create_ERA5_monthly_mean.py +74 -0
  42. OceanDataStore/data/ERA5/run_create_ERA5_daily_climatology.slurm +54 -0
  43. OceanDataStore/data/ERA5/run_send_ERA5_daily_climatology_to_os.slurm +32 -0
  44. OceanDataStore/data/ERA5/run_send_ERA5_daily_to_os.slurm +32 -0
  45. OceanDataStore/data/ERA5/run_send_ERA5_monthly_to_os.slurm +32 -0
  46. OceanDataStore/data/ERA5/run_update_ERA5_daily_to_os.slurm +32 -0
  47. OceanDataStore/data/ERA5/run_update_ERA5_monthly_to_os.slurm +32 -0
  48. OceanDataStore/data/ERA5/send_ERA5_daily_climatology_to_os.py +159 -0
  49. OceanDataStore/data/ERA5/send_ERA5_daily_to_os.py +141 -0
  50. OceanDataStore/data/ERA5/send_ERA5_monthly_to_os.py +173 -0
  51. OceanDataStore/data/ERA5/update_ERA5_daily_to_os.py +141 -0
  52. OceanDataStore/data/ERA5/update_ERA5_monthly_to_os.py +169 -0
  53. OceanDataStore/data/HadISST/download_HadISST1_data.sh +43 -0
  54. OceanDataStore/data/HadISST/run_send_HadISST1_monthly_to_os.slurm +32 -0
  55. OceanDataStore/data/HadISST/send_HadISST1_monthly_to_os.py +133 -0
  56. OceanDataStore/data/NSIDC/download_NSIDC_monthly_1979_2025_data.sh +54 -0
  57. OceanDataStore/data/NSIDC/process_NSIDC_SSI_Antarctic_data.py +130 -0
  58. OceanDataStore/data/NSIDC/process_NSIDC_SSI_Arctic_data.py +129 -0
  59. OceanDataStore/data/NSIDC/run_send_NSIDC_v4.0_to_OS.slurm +32 -0
  60. OceanDataStore/data/NSIDC/send_NSIDC_SII_v4.0_to_os.py +140 -0
  61. OceanDataStore/data/OISST/create_OISSTv2_daily_climatology.py +83 -0
  62. OceanDataStore/data/OISST/download_oisstv2_data.sh +43 -0
  63. OceanDataStore/data/OISST/run_create_OISSTv2_daily_climatology.slurm +44 -0
  64. OceanDataStore/data/OISST/run_send_OISSTv2_daily_climatology_to_os.slurm +32 -0
  65. OceanDataStore/data/OISST/run_send_OISSTv2_daily_to_os.slurm +32 -0
  66. OceanDataStore/data/OISST/run_send_OISSTv2_monthly_climatology_to_os.slurm +32 -0
  67. OceanDataStore/data/OISST/run_send_OISSTv2_monthly_to_os.slurm +32 -0
  68. OceanDataStore/data/OISST/run_update_OISSTv2_daily_to_os.slurm +32 -0
  69. OceanDataStore/data/OISST/send_OISSTv2_daily_climatology_to_os.py +154 -0
  70. OceanDataStore/data/OISST/send_OISSTv2_daily_ltm_climatology_to_os.py +151 -0
  71. OceanDataStore/data/OISST/send_OISSTv2_daily_to_os.py +142 -0
  72. OceanDataStore/data/OISST/send_OISSTv2_monthly_climatology_to_os.py +150 -0
  73. OceanDataStore/data/OISST/send_OISSTv2_monthly_to_os.py +145 -0
  74. OceanDataStore/data/OISST/update_OISSTv2_daily_to_os.py +142 -0
  75. OceanDataStore/data/OSTIA/create_OSTIA_daily_climatology.py +120 -0
  76. OceanDataStore/data/OSTIA/download_OSTIA_NRT.py +42 -0
  77. OceanDataStore/data/OSTIA/download_OSTIA_REP_1981_2025.py +42 -0
  78. OceanDataStore/data/OSTIA/run_create_OSTIA_daily_climatology.slurm +54 -0
  79. OceanDataStore/data/OSTIA/run_send_OSTIA_daily_climatology_to_os.slurm +32 -0
  80. OceanDataStore/data/OSTIA/run_send_OSTIA_nrt_daily_to_os.slurm +32 -0
  81. OceanDataStore/data/OSTIA/run_send_OSTIA_rep_daily_to_os.slurm +32 -0
  82. OceanDataStore/data/OSTIA/run_update_OSTIA_daily_to_os.slurm +33 -0
  83. OceanDataStore/data/OSTIA/send_OSTIA_daily_climatology_to_os.py +194 -0
  84. OceanDataStore/data/OSTIA/send_OSTIA_nrt_daily_to_os.py +141 -0
  85. OceanDataStore/data/OSTIA/send_OSTIA_rep_daily_to_os.py +145 -0
  86. OceanDataStore/data/OSTIA/update_OSTIA_copernicus_nrt_daily_to_os.py +144 -0
  87. OceanDataStore/data/OSTIA/update_OSTIA_nrt_daily_to_os.py +137 -0
  88. OceanDataStore/data/WOA23/download_WOA23_climatology.sh +41 -0
  89. OceanDataStore/data/WOA23/run_send_WOA23_annual_climatology_to_os.slurm +32 -0
  90. OceanDataStore/data/WOA23/run_send_WOA23_monthly_climatology_to_os.slurm +32 -0
  91. OceanDataStore/data/WOA23/send_WOA23_annual_climatology_to_os.py +263 -0
  92. OceanDataStore/data/WOA23/send_WOA23_monthly_climatology_to_os.py +292 -0
  93. OceanDataStore/data/update_icechunk_repo_attrs.py +76 -0
  94. OceanDataStore/data/update_noc_npd_era5v1_attrs.py +172 -0
  95. OceanDataStore/data/utils.py +506 -0
  96. OceanDataStore/zarr.py +993 -0
  97. oceandatastore-0.3.0.dist-info/METADATA +184 -0
  98. oceandatastore-0.3.0.dist-info/RECORD +104 -0
  99. oceandatastore-0.3.0.dist-info/WHEEL +5 -0
  100. oceandatastore-0.3.0.dist-info/entry_points.txt +2 -0
  101. oceandatastore-0.3.0.dist-info/licenses/LICENSE +201 -0
  102. oceandatastore-0.3.0.dist-info/scm_file_list.json +154 -0
  103. oceandatastore-0.3.0.dist-info/scm_version.json +8 -0
  104. oceandatastore-0.3.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,196 @@
1
+ """
2
+ npd_jra55v1_collection.py
3
+
4
+ Description:
5
+ Function to create the National Oceanography Centre (NOC)
6
+ Near-Present Day JRA55-do version 1 Spatio-Temporal Access
7
+ Catalog Collection.
8
+
9
+ Authors:
10
+ - Ollie Tooth (oliver.tooth@noc.ac.uk)
11
+ """
12
+ # -- Import Python Modules -- #
13
+ import logging
14
+ import pystac
15
+ import datetime
16
+ import xarray as xr
17
+
18
+ from OceanDataStore.catalog.stac.utils import create_item_with_zarr_asset
19
+
20
+
21
+ def create_npd_jra55_collection(
22
+ ) -> pystac.Collection:
23
+ """
24
+ Create the NOC Near-Present Day JRA55-do version 1 STAC Collection.
25
+
26
+ Returns:
27
+ -------
28
+ npd_collection : pystac.Collection
29
+ NOC Near-Present Day JRA55-do version 1 STAC Collection.
30
+ """
31
+ # -- Define NOC Near-Present Day JRA55-do Collection -- #
32
+ # Define the spatial extent for the collection:
33
+ spatial_extent = pystac.SpatialExtent(bboxes=[[-180.0, -90.0, 0, 180.0, 90.0, 6000]])
34
+
35
+ # Define the current temporal extent for the collection:
36
+ collection_interval = sorted([datetime.datetime(year=1976, month=1, day=1), datetime.datetime(year=2024, month=2, day=1)])
37
+ temporal_extent = pystac.TemporalExtent(intervals=[collection_interval])
38
+
39
+ # Define the Near-Present Day Collection:
40
+ npd_collection = pystac.Collection(
41
+ id="noc-npd-jra55",
42
+ title="NOC Near-Present Day JRA55-do Collection",
43
+ description="**About:**\n\nCollection of multi-decadal Near-Present Day ocean model hindcast simulations produced by the National Oceanography Centre (NOC) using JRA55-do atmospheric forcing as part of the Atlantic Climate and Environment Strategic Science (AtlantiS) programme.\n\n**More Information:**\n - [AtlantiS](https://atlantis.ac.uk)\n - [NOC Near-Present Day](https://noc-msm.github.io/NOC_Near_Present_Day/)",
44
+ extent=pystac.Extent(spatial=spatial_extent, temporal=temporal_extent),
45
+ # Open Government License (OGL) - UK version 3.0 - http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/
46
+ license="OGL-UK-3.0",
47
+ extra_fields=dict(contact="Ollie Tooth (oliver.tooth@noc.ac.uk)", project="AtlantiS", status="completed", last_data_update="2025-05-30"),
48
+ keywords=["NOC", "JRA55-do", "Near-Present Day", "AtlantiS", "hindcast", "global", "model", "ocean", "sea-ice"],
49
+ providers=[
50
+ pystac.Provider(
51
+ name="National Oceanography Centre (NOC)",
52
+ description="National Oceanography Centre (United Kingdom) - Ocean Modelling Group.",
53
+ roles=[pystac.ProviderRole.PRODUCER, pystac.ProviderRole.LICENSOR],
54
+ url="https://noc-msm.github.io/NOC_Near_Present_Day/"
55
+ ),
56
+ pystac.Provider(
57
+ name="JASMIN",
58
+ description="JASMIN Environmental Data Analysis Facility (United Kingdom).",
59
+ roles=[pystac.ProviderRole.HOST],
60
+ url="https://jasmin.ac.uk"
61
+ )
62
+ ],
63
+ )
64
+
65
+ logging.info(f"Completed: Created NOC STAC Collection with ID: {npd_collection.id}")
66
+
67
+ # ==== Define NOC Near-Present Day Model Simulations Catalogs ==== #
68
+ npd_eorca1_jra55v1 = pystac.Catalog(
69
+ id="npd-eorca1-jra55v1",
70
+ title="eORCA1 JRA55v1 NPD Catalog",
71
+ description="Catalog of eORCA1 JRA55-do Near-Present Day ocean sea-ice simulations performed by the National Oceanography Centre."
72
+ )
73
+
74
+ logging.info(f"Completed: Created STAC Catalog with ID: {npd_eorca1_jra55v1.id}")
75
+
76
+ npd_eorca025_jra55v1 = pystac.Catalog(
77
+ id="npd-eorca025-jra55v1",
78
+ title="eORCA025 JRA55v1 NPD Catalog",
79
+ description="Catalog of eORCA025 JRA55-do Near-Present Day ocean sea-ice simulations performed by the National Oceanography Centre.",
80
+ )
81
+
82
+ logging.info(f"Completed: Created STAC Catalog with ID: {npd_eorca025_jra55v1.id}")
83
+
84
+ # ==== Define NOC Near-Present Day Model Variant Catalogs ==== #
85
+ r1i1c1f1_eorca1_jra55v1 = pystac.Catalog(
86
+ id="r1i1c1f1",
87
+ title="eORCA1 JRA55v1 NPD: r1i1c1f1 Catalog",
88
+ description="Catalog of eORCA1 JRA55-do Near-Present Day ocean physics & sea-ice outputs for model variant: r1i1c1f1.\n\n**Variant Label:**\n\nRealisation=1, Initialisation=1, Configuration=1, Forcing=1."
89
+ )
90
+
91
+ logging.info(f"Completed: Created STAC Catalog with ID: {r1i1c1f1_eorca1_jra55v1.id}")
92
+
93
+ r1i1c1f1_eorca025_jra55v1 = pystac.Catalog(
94
+ id="r1i1c1f1",
95
+ title="eORCA025 JRA55v1 NPD: r1i1c1f1 Catalog",
96
+ description="Catalog of eORCA025 JRA55-do Near-Present Day ocean physics & sea-ice outputs for model variant: r1i1c1f1.\n\n**Variant Label:**\n\nRealisation=1, Initialisation=1, Configuration=1, Forcing=1.",
97
+ )
98
+
99
+ logging.info(f"Completed: Created STAC Catalog with ID: {r1i1c1f1_eorca025_jra55v1.id}")
100
+
101
+ # -- Add Items to NOC Near-Present Day eORCA1 JRA55v1 {gn} Sub-Catalog -- #
102
+ # Define url & bucket for eORCA1 JRA55v1 NPD data:
103
+ endpoint_url="https://noc-msm-o.s3-ext.jc.rl.ac.uk"
104
+ bucket="npd-eorca1-jra55v1"
105
+ variant="r1i1c1f1"
106
+
107
+ for prefix in ["T1y", "U1y", "V1y", "W1y", "I1y", "S1y", "T1m", "U1m", "V1m", "W1m", "I1m", "S1m",
108
+ "domain_cfg"
109
+ ]:
110
+ # Open dataset from Zarr store:
111
+ ds = xr.open_zarr(f"{endpoint_url}/{bucket}/{prefix}")
112
+
113
+ # Create item with asset for each eORCA1 JRA55v1 NPD prefix:
114
+ if 'domain' in prefix:
115
+ operation = "None None"
116
+ elif '1y' in prefix:
117
+ operation = "annual mean"
118
+ elif '1m' in prefix:
119
+ operation = "monthly mean"
120
+ elif '5d' in prefix:
121
+ operation = "5-day mean"
122
+
123
+ item = create_item_with_zarr_asset(
124
+ id=f"noc-npd-jra55/{bucket}/{variant}/{prefix}",
125
+ ds=ds,
126
+ bucket=bucket,
127
+ prefix=prefix,
128
+ title=f"NPD eORCA1 JRA55v1 {prefix}",
129
+ platform="gn",
130
+ horizontal_grid_resolution="1 degree",
131
+ variant=variant,
132
+ start_date="1976-01-01",
133
+ end_date="2024-01-31",
134
+ operation=operation,
135
+ zarr_format=3,
136
+ variable_stores=False,
137
+ )
138
+ # Add item to the eORCA1 JRA55v1 NPD global native model grid catalog:
139
+ r1i1c1f1_eorca1_jra55v1.add_item(item)
140
+
141
+ logging.info(f"Completed: Added Items to STAC Catalog with ID: {r1i1c1f1_eorca1_jra55v1.id}")
142
+
143
+ # -- Add Items to NOC Near-Present Day eORCA025 JRA55v1 {gn} Sub-Catalog -- #
144
+ # Define url & bucket for eORCA025 JRA55v1 NPD data:
145
+ endpoint_url="https://noc-msm-o.s3-ext.jc.rl.ac.uk"
146
+ bucket="npd-eorca025-jra55v1"
147
+ variant="r1i1c1f1"
148
+
149
+ for prefix in ["T1y_3d", "T1y_4d", "U1y_3d", "U1y_4d", "V1y_3d", "V1y_4d", "W1y_4d", "I1y_3d", "S1y_1d",
150
+ "T1m_3d", "T1m_4d", "U1m_3d", "U1m_4d", "V1m_3d", "V1m_4d", "W1m_4d", "I1m_3d", "S1m_1d",
151
+ "domain_cfg"
152
+ ]:
153
+ # Open dataset from Zarr store:
154
+ ds = xr.open_zarr(f"{endpoint_url}/{bucket}/{prefix}")
155
+
156
+ # Create item with asset for each eORCA025 JRA55v1 NPD prefix:
157
+ if 'domain' in prefix:
158
+ operation = "None None"
159
+ elif '1y' in prefix:
160
+ operation = "annual mean"
161
+ elif '1m' in prefix:
162
+ operation = "monthly mean"
163
+ elif '5d' in prefix:
164
+ operation = "5-day mean"
165
+
166
+ item = create_item_with_zarr_asset(
167
+ id=f"noc-npd-jra55/{bucket}/{variant}/{prefix}",
168
+ ds=ds,
169
+ bucket=bucket,
170
+ prefix=prefix,
171
+ title=f"NPD eORCA025 JRA55v1 {prefix}",
172
+ platform="gn",
173
+ horizontal_grid_resolution="1/4 degree",
174
+ variant=variant,
175
+ start_date="1976-01-01",
176
+ end_date="2024-01-31",
177
+ operation=operation,
178
+ zarr_format=3,
179
+ variable_stores=False
180
+ )
181
+ # Add item to the eORCA025 JRA55v1 NPD global native model grid catalog:
182
+ r1i1c1f1_eorca025_jra55v1.add_item(item)
183
+
184
+ logging.info(f"Completed: Added Items to STAC Catalog with ID: {r1i1c1f1_eorca025_jra55v1.id}")
185
+
186
+ # ==== Add Nested Catalogs to NOC Near-Present Day Collection ==== #
187
+
188
+ # Model Simulation Variant Catalogs -> Model Simulation Catalogs:
189
+ npd_eorca1_jra55v1.add_child(r1i1c1f1_eorca1_jra55v1)
190
+ npd_eorca025_jra55v1.add_child(r1i1c1f1_eorca025_jra55v1)
191
+
192
+ # Model Simulation Catalogs -> Near-Present Day Collection:
193
+ npd_collection.add_child(npd_eorca1_jra55v1)
194
+ npd_collection.add_child(npd_eorca025_jra55v1)
195
+
196
+ return npd_collection