Skip to content

Commit 54ec175

Browse files
rhaegar325rbeucherdougiesquire
authored
update for OM2 (#110)
* update for OM2 * format organising * format organising * Update write() to prevent Dask crashes due to excessive memory usage * fake om2_01 metadata * update to solve grid issue * grid update * update grid mechanism for OM2 * format * format * end of file fixer * organise * update for grid * update for B and C grid * fix for pass ruff * Refactor documentation requirements in requirements.txt to remove unnecessary build configuration * Fix ruff * Restore CMIP6 vocab file * Fix and restucture MOM supergrid logic for OM2 and OM3 (#128) * Fix and restucture MOM supergrid logic for OM2 and OM3 * Add support for staggered variables on B-grid * update conditional logic * fix format --------- Co-authored-by: rhaegar325 <[email protected]> * Fix merge conflicts --------- Co-authored-by: rbeucher <[email protected]> Co-authored-by: Dougie Squire <[email protected]>
1 parent bcfeaa1 commit 54ec175

File tree

6 files changed

+449
-226
lines changed

6 files changed

+449
-226
lines changed

docs/requirements.txt

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
version: 2
2-
3-
build:
4-
os: ubuntu-22.04
5-
tools:
6-
python: "3.13"
7-
8-
sphinx:
9-
configuration: docs/source/conf.py
10-
fail_on_warning: false
11-
12-
formats:
13-
- pdf
14-
- epub
15-
16-
python:
17-
install:
18-
- method: pip
19-
path: .
20-
extra_requirements:
21-
- docs
1+
###############################
2+
# Documentation requirements #
3+
###############################
4+
# Tip: For local builds you can also run:
5+
# pip install -e .[docs]
6+
# which uses the extras defined in pyproject.toml
227

238
# Core documentation dependencies
249
sphinx>=7.0.0

src/access_moppy/driver.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from access_moppy.atmosphere import CMIP6_Atmosphere_CMORiser
66
from access_moppy.defaults import _default_parent_info
7-
from access_moppy.ocean import CMIP6_Ocean_CMORiser
7+
from access_moppy.ocean import CMIP6_Ocean_CMORiser_OM2, CMIP6_Ocean_CMORiser_OM3
88
from access_moppy.utilities import load_model_mappings
99
from access_moppy.vocabulary_processors import CMIP6Vocabulary
1010

@@ -106,17 +106,28 @@ def __init__(
106106
resampling_method=self.resampling_method,
107107
)
108108
elif table in ("Oyr", "Oday", "Omon", "SImon"):
109-
self.cmoriser = CMIP6_Ocean_CMORiser(
110-
input_paths=self.input_paths,
111-
output_path=str(self.output_path),
112-
cmip6_vocab=self.vocab,
113-
variable_mapping=self.variable_mapping,
114-
compound_name=self.compound_name,
115-
drs_root=drs_root if drs_root else None,
116-
validate_frequency=self.validate_frequency,
117-
enable_resampling=self.enable_resampling,
118-
resampling_method=self.resampling_method,
119-
)
109+
if self.source_id == "ACCESS-OM3":
110+
# ACCESS-OM3 uses MOM6 (C-grid) — requires dedicated CMORiser implementation
111+
# that handles C-grid supergrid logic, MOM6 metadata, and OM3-specific conventions
112+
self.cmoriser = CMIP6_Ocean_CMORiser_OM3(
113+
input_paths=self.input_paths,
114+
output_path=str(self.output_path),
115+
compound_name=self.compound_name,
116+
cmip6_vocab=self.vocab,
117+
variable_mapping=self.variable_mapping,
118+
drs_root=drs_root if drs_root else None,
119+
)
120+
else:
121+
# ACCESS-OM2 uses MOM5 (B-grid) — handled by a separate CMORiser class
122+
# specialized for B-grid variable locations and OM2-specific metadata
123+
self.cmoriser = CMIP6_Ocean_CMORiser_OM2(
124+
input_paths=self.input_paths,
125+
output_path=str(self.output_path),
126+
compound_name=self.compound_name,
127+
cmip6_vocab=self.vocab,
128+
variable_mapping=self.variable_mapping,
129+
drs_root=drs_root if drs_root else None,
130+
)
120131

121132
def __getitem__(self, key):
122133
return self.cmoriser.ds[key]

src/access_moppy/mappings/ACCESS-ESM1.6_mappings.json

Lines changed: 43 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,8 @@
252252
"CF standard Name": "specific_humidity",
253253
"dimensions": {
254254
"time": "time",
255-
"lat": "lat",
256-
"lon": "lon"
255+
"lat_v": "lat",
256+
"lon_u": "lon"
257257
},
258258
"units": "1",
259259
"positive": null,
@@ -2025,8 +2025,8 @@
20252025
"ficeberg2d": {
20262026
"dimensions": {
20272027
"time": "time",
2028-
"yt_ocean": "latitude",
2029-
"xt_ocean": "longitude"
2028+
"yh": "latitude",
2029+
"xh": "longitude"
20302030
},
20312031
"units": "kg m-2 s-1",
20322032
"positive": null,
@@ -2042,8 +2042,8 @@
20422042
"friver": {
20432043
"dimensions": {
20442044
"time": "time",
2045-
"yt_ocean": "latitude",
2046-
"xt_ocean": "longitude"
2045+
"yh": "latitude",
2046+
"xh": "longitude"
20472047
},
20482048
"units": "kg m-2 s-1",
20492049
"positive": null,
@@ -2056,28 +2056,11 @@
20562056
},
20572057
"CF standard Name": ""
20582058
},
2059-
"fsitherm": {
2060-
"dimensions": {
2061-
"time": "time",
2062-
"yt_ocean": "latitude",
2063-
"xt_ocean": "longitude"
2064-
},
2065-
"units": "kg m-2 s-1",
2066-
"positive": null,
2067-
"model_variables": [
2068-
"melt"
2069-
],
2070-
"calculation": {
2071-
"type": "direct",
2072-
"formula": "melt"
2073-
},
2074-
"CF standard Name": ""
2075-
},
20762059
"hfds": {
20772060
"dimensions": {
20782061
"time": "time",
2079-
"yt_ocean": "latitude",
2080-
"xt_ocean": "longitude"
2062+
"yh": "latitude",
2063+
"xh": "longitude"
20812064
},
20822065
"units": "W m-2",
20832066
"positive": null,
@@ -2099,8 +2082,8 @@
20992082
"hfevapds": {
21002083
"dimensions": {
21012084
"time": "time",
2102-
"yt_ocean": "latitude",
2103-
"xt_ocean": "longitude"
2085+
"yh": "latitude",
2086+
"xh": "longitude"
21042087
},
21052088
"units": "W m-2",
21062089
"positive": null,
@@ -2116,8 +2099,8 @@
21162099
"hfibthermds2d": {
21172100
"dimensions": {
21182101
"time": "time",
2119-
"yt_ocean": "latitude",
2120-
"xt_ocean": "longitude"
2102+
"yh": "latitude",
2103+
"xh": "longitude"
21212104
},
21222105
"units": "W m-2",
21232106
"positive": null,
@@ -2133,8 +2116,8 @@
21332116
"hflso": {
21342117
"dimensions": {
21352118
"time": "time",
2136-
"yt_ocean": "latitude",
2137-
"xt_ocean": "longitude"
2119+
"yh": "latitude",
2120+
"xh": "longitude"
21382121
},
21392122
"units": "W m-2",
21402123
"positive": null,
@@ -2150,8 +2133,8 @@
21502133
"hfrainds": {
21512134
"dimensions": {
21522135
"time": "time",
2153-
"yt_ocean": "latitude",
2154-
"xt_ocean": "longitude"
2136+
"yh": "latitude",
2137+
"xh": "longitude"
21552138
},
21562139
"units": "W m-2",
21572140
"positive": null,
@@ -2167,8 +2150,8 @@
21672150
"hfrunoffds2d": {
21682151
"dimensions": {
21692152
"time": "time",
2170-
"yt_ocean": "latitude",
2171-
"xt_ocean": "longitude"
2153+
"yh": "latitude",
2154+
"xh": "longitude"
21722155
},
21732156
"units": "W m-2",
21742157
"positive": null,
@@ -2226,8 +2209,8 @@
22262209
"hfsnthermds2d": {
22272210
"dimensions": {
22282211
"time": "time",
2229-
"yt_ocean": "latitude",
2230-
"xt_ocean": "longitude"
2212+
"yh": "latitude",
2213+
"xh": "longitude"
22312214
},
22322215
"units": "W m-2",
22332216
"positive": null,
@@ -2243,8 +2226,8 @@
22432226
"hfsso": {
22442227
"dimensions": {
22452228
"time": "time",
2246-
"yt_ocean": "latitude",
2247-
"xt_ocean": "longitude"
2229+
"yh": "latitude",
2230+
"xh": "longitude"
22482231
},
22492232
"units": "W m-2",
22502233
"positive": null,
@@ -2278,8 +2261,8 @@
22782261
"mlotst": {
22792262
"dimensions": {
22802263
"time": "time",
2281-
"yt_ocean": "latitude",
2282-
"xt_ocean": "longitude"
2264+
"yh": "latitude",
2265+
"xh": "longitude"
22832266
},
22842267
"units": "m",
22852268
"positive": null,
@@ -2295,8 +2278,8 @@
22952278
"mlotstsq": {
22962279
"dimensions": {
22972280
"time": "time",
2298-
"yt_ocean": "latitude",
2299-
"xt_ocean": "longitude"
2281+
"yh": "latitude",
2282+
"xh": "longitude"
23002283
},
23012284
"units": "m2",
23022285
"positive": null,
@@ -2334,8 +2317,8 @@
23342317
"pbo": {
23352318
"dimensions": {
23362319
"time": "time",
2337-
"yt_ocean": "latitude",
2338-
"xt_ocean": "longitude"
2320+
"yh": "latitude",
2321+
"xh": "longitude"
23392322
},
23402323
"units": "dbar",
23412324
"positive": null,
@@ -2352,28 +2335,11 @@
23522335
},
23532336
"CF standard Name": ""
23542337
},
2355-
"prra": {
2356-
"dimensions": {
2357-
"time": "time",
2358-
"yt_ocean": "latitude",
2359-
"xt_ocean": "longitude"
2360-
},
2361-
"units": "kg m-2 s-1",
2362-
"positive": null,
2363-
"model_variables": [
2364-
"lprec"
2365-
],
2366-
"calculation": {
2367-
"type": "direct",
2368-
"formula": "lprec"
2369-
},
2370-
"CF standard Name": ""
2371-
},
23722338
"pso": {
23732339
"dimensions": {
23742340
"time": "time",
2375-
"yt_ocean": "latitude",
2376-
"xt_ocean": "longitude"
2341+
"yh": "latitude",
2342+
"xh": "longitude"
23772343
},
23782344
"units": "Pa",
23792345
"positive": null,
@@ -2389,8 +2355,8 @@
23892355
"rlntds": {
23902356
"dimensions": {
23912357
"time": "time",
2392-
"yt_ocean": "latitude",
2393-
"xt_ocean": "longitude"
2358+
"yh": "latitude",
2359+
"xh": "longitude"
23942360
},
23952361
"units": "W m-2",
23962362
"positive": null,
@@ -2424,8 +2390,8 @@
24242390
"rsntds": {
24252391
"dimensions": {
24262392
"time": "time",
2427-
"yt_ocean": "latitude",
2428-
"xt_ocean": "longitude"
2393+
"yh": "latitude",
2394+
"xh": "longitude"
24292395
},
24302396
"units": "W m-2",
24312397
"positive": null,
@@ -2438,31 +2404,14 @@
24382404
},
24392405
"CF standard Name": ""
24402406
},
2441-
"sfdsi": {
2407+
"sfriver": {
24422408
"dimensions": {
24432409
"time": "time",
24442410
"yh": "latitude",
24452411
"xh": "longitude"
24462412
},
24472413
"units": "kg m-2 s-1",
24482414
"positive": null,
2449-
"model_variables": [
2450-
"sfc_salt_flux_ice"
2451-
],
2452-
"calculation": {
2453-
"type": "direct",
2454-
"formula": "sfc_salt_flux_ice"
2455-
},
2456-
"CF standard Name": ""
2457-
},
2458-
"sfriver": {
2459-
"dimensions": {
2460-
"time": "time",
2461-
"yt_ocean": "latitude",
2462-
"xt_ocean": "longitude"
2463-
},
2464-
"units": "kg m-2 s-1",
2465-
"positive": null,
24662415
"model_variables": [
24672416
"sfc_salt_flux_runoff"
24682417
],
@@ -2475,8 +2424,8 @@
24752424
"sob": {
24762425
"dimensions": {
24772426
"time": "time",
2478-
"yt_ocean": "latitude",
2479-
"xt_ocean": "longitude"
2427+
"yh": "latitude",
2428+
"xh": "longitude"
24802429
},
24812430
"units": "psu",
24822431
"positive": null,
@@ -2510,8 +2459,8 @@
25102459
"sos": {
25112460
"dimensions": {
25122461
"time": "time",
2513-
"yt_ocean": "latitude",
2514-
"xt_ocean": "longitude"
2462+
"yh": "latitude",
2463+
"xh": "longitude"
25152464
},
25162465
"units": "psu",
25172466
"positive": null,
@@ -2658,8 +2607,8 @@
26582607
"wfo": {
26592608
"dimensions": {
26602609
"time": "time",
2661-
"yt_ocean": "latitude",
2662-
"xt_ocean": "longitude"
2610+
"yh": "latitude",
2611+
"xh": "longitude"
26632612
},
26642613
"units": "kg m-2 s-1",
26652614
"positive": null,
@@ -2728,8 +2677,8 @@
27282677
"zossq": {
27292678
"dimensions": {
27302679
"time": "time",
2731-
"yt_ocean": "latitude",
2732-
"xt_ocean": "longitude"
2680+
"yh": "latitude",
2681+
"xh": "longitude"
27332682
},
27342683
"units": "m2",
27352684
"positive": null,

0 commit comments

Comments
 (0)