Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ACCESS-OM2 variables to on-the-fly CMORiser #2587

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e6d7253
add regular express facet
rhaegar325 Jul 23, 2024
6aff095
add ocean variables
rhaegar325 Oct 21, 2024
76f147e
add more atm variables
rhaegar325 Oct 23, 2024
c765261
update config-dev.yml and add test recipe
rhaegar325 Nov 8, 2024
2ea176e
update config-dev.yml and add test recipe
rhaegar325 Nov 8, 2024
1770e41
delete regular_expression in doc
rhaegar325 Nov 25, 2024
1f95013
fix units
rhaegar325 Nov 25, 2024
37e0ddb
fix test_access_esm1_5.py
rhaegar325 Nov 25, 2024
5a1805f
Merge pull request #1 from ACCESS-NRI/add-more-variables-live-cmoriser
rhaegar325 Nov 25, 2024
41e3529
tune format
rhaegar325 Nov 26, 2024
31ec2ca
fix documentation issue
rhaegar325 Nov 26, 2024
97eea6e
fix function doc format
rhaegar325 Nov 26, 2024
7c6db47
fix doc
rhaegar325 Nov 26, 2024
f1fd769
fix function format
rhaegar325 Nov 26, 2024
445335e
fix function format
rhaegar325 Nov 26, 2024
7525421
fix format
rhaegar325 Nov 27, 2024
48e6aa2
resolve conflict
rhaegar325 Dec 1, 2024
5e12dc5
test
rhaegar325 Dec 1, 2024
07d99c2
fix errror
rhaegar325 Dec 1, 2024
e100b89
fix doc error
rhaegar325 Dec 1, 2024
041b50f
fix link break
rhaegar325 Dec 1, 2024
f081537
fix repeat
rhaegar325 Dec 1, 2024
a1782bc
fix repeat
rhaegar325 Dec 1, 2024
771901f
fix units error
rhaegar325 Dec 1, 2024
4561d90
fix units error
rhaegar325 Dec 1, 2024
79931cb
fix assert error
rhaegar325 Dec 1, 2024
98caf58
fix assert error
rhaegar325 Dec 1, 2024
ff2e659
fix assert error
rhaegar325 Dec 1, 2024
d65df55
fix assert error
rhaegar325 Dec 1, 2024
f0123ed
fix assert error
rhaegar325 Dec 2, 2024
7a066a8
fix assert error
rhaegar325 Dec 2, 2024
f286722
fix assert error
rhaegar325 Dec 2, 2024
e76c43b
fix test script
rhaegar325 Dec 2, 2024
4a15aa5
fix test script
rhaegar325 Dec 2, 2024
10c8c92
fix test script
rhaegar325 Dec 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/quickstart/find_data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,8 @@ Key Description Default value if not
raw input file corresponding variable
``modeling_realm`` Realm attribute include `atm`, `ice` No default (needs to be
and `oce` specified in extra facets or
recipe if default DRS is used)
```special_attr`` A special attribute in the filename No default
recipe if default DRS is used)
``freq_attribute`` A special attribute in the filename No default
`ACCESS-ESM` raw data, it's related to
frequency of raw data
``sub_dataset`` Part of the ACCESS-ESM raw dataset No default
Expand Down
40 changes: 39 additions & 1 deletion esmvalcore/cmor/_fixes/access/_base_fix.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging

import numpy as np
from iris.cube import CubeList

from esmvalcore.cmor._fixes.native_datasets import NativeDatasetFix
Expand All @@ -20,9 +21,46 @@ def fix_coord_system(self, cube):

def get_cubes_from_multivar(self, cubes):
"""Get cube before calculate from multiple variables."""
name_list = self.extra_facets.get("raw_name", self.vardef.short_name)
name_list = self.extra_facets.get('raw_name', self.vardef.short_name)

data_list = []
for name in name_list:
data_list.append(self.get_cube(cubes, name))
return CubeList(data_list)

def fix_ocean_dim_coords(self, cube):
"""Fix dim coords of ocean variables."""
cube.dim_coords[-2].points = np.array([int(i) for i in range(300)])
cube.dim_coords[-2].standard_name = None
cube.dim_coords[-2].var_name = 'j'
cube.dim_coords[-2].long_name = 'cell index along second dimension'
cube.dim_coords[-2].attributes = None

cube.dim_coords[-1].points = np.array([int(i) for i in range(360)])
cube.dim_coords[-1].standard_name = None
cube.dim_coords[-1].var_name = 'i'
cube.dim_coords[-1].long_name = 'cell index along first dimension'
cube.dim_coords[-1].attributes = None

def fix_ocean_aux_coords(self, cube):
"""Fix aux coords of ocean variables."""
temp_points = []
for i in cube.aux_coords[-1].points:
temp_points.append([j + 360 for j in i if j < 0]
+ [j for j in i if j >= 0])
cube.aux_coords[-1].points = np.array(temp_points)
cube.aux_coords[-1].standard_name = 'longitude'
cube.aux_coords[-1].long_name = 'longitude'
cube.aux_coords[-1].var_name = 'longitude'
cube.aux_coords[-1].attributes = None
cube.aux_coords[-1].units = 'degrees'

temp_points = []
for i in cube.aux_coords[-2].points:
temp_points.append([j.astype(np.float64) for j in i])
cube.aux_coords[-2].points = np.array(temp_points)
cube.aux_coords[-2].standard_name = 'latitude'
cube.aux_coords[-2].long_name = 'latitude'
cube.aux_coords[-2].var_name = 'latitude'
cube.aux_coords[-2].attributes = None
cube.aux_coords[-2].units = 'degrees'
65 changes: 63 additions & 2 deletions esmvalcore/cmor/_fixes/access/access_esm1_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import logging

from cf_units import Unit
from iris.cube import CubeList

from ._base_fix import AccessFix
Expand Down Expand Up @@ -124,5 +125,65 @@ def fix_metadata(self, cubes):

def fix_height_value(self, cube):
"""Fix height value to make it comparable to other dataset."""
if cube.coord("height").points[0] != 2:
cube.coord("height").points = [2]
if cube.coord('height').points[0] != 2:
cube.coord('height').points = [2]


class Tos(AccessFix):
"""Fixes for Tos."""

def fix_metadata(self, cubes):
"""Fix metadata.

Parameters
----------
cubes : iris.cube.CubeList
Input cubes.

Returns
-------
iris.cube.CubeList
"""
cube = self.get_cube(cubes)

self.fix_ocean_dim_coords(cube)
self.fix_ocean_aux_coords(cube)

return CubeList([cube])


class So(AccessFix):
"""FIxes for So."""

def fix_metadata(self, cubes):
"""Fix metadata.

Parameters
----------
cubes : iris.cube.CubeList
Input cubes.

Returns
-------
iris.cube.CubeList
"""
cube = self.get_cube(cubes)

self.fix_ocean_dim_coords(cube)
self.fix_ocean_aux_coords(cube)
self.fix_depth_metadata(cube)
self.fix_so_units(cube)

return CubeList([cube])

def fix_depth_metadata(self, cube):
"""Fix depth metadata."""
cube.dim_coords[1].standard_name = 'depth'
cube.dim_coords[1].long_name = 'ocean depth coordinate'
cube.dim_coords[1].var_name = 'lev'
cube.dim_coords[1].attributes = {'positive': 'down'}

def fix_so_units(self, cube):
"""Fix units of so."""
cube.attributes.pop('invalid_units')
cube.units = Unit(0.001)
7 changes: 5 additions & 2 deletions esmvalcore/config-developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,11 @@ ACCESS:
input_dir:
default:
- '{dataset}/{sub_dataset}/{exp}/{modeling_realm}/netCDF'
- '{dataset}/{sub_dataset}/{exp}/{modeling_realm}/'
input_file:
default: '{sub_dataset}.{special_attr}-*.nc'
output_file: '{project}_{dataset}_{mip}_{exp}_{institute}_{sub_dataset}_{special_attr}_{short_name}'
default:
- '{sub_dataset}.{freq_attribute}-*.nc'
- 'ocean_{freq_attribute}.nc-*'
output_file: '{project}_{dataset}_{mip}_{exp}_{institute}_{sub_dataset}_{freq_attribute}_{short_name}'
cmor_type: 'CMIP6'
cmor_default_table_prefix: 'CMIP6_'
152 changes: 136 additions & 16 deletions esmvalcore/config/extra_facets/access-mappings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,61 +7,181 @@
ACCESS-ESM1-5:

'*':

# atm

tas:
raw_name: fld_s03i236
modeling_realm: atm

pr:
raw_name: fld_s05i216
modeling_realm: atm

ps:
raw_name: fld_s00i409
modeling_realm: atm

clt:
raw_name: fld_s02i204
modeling_realm: atm

psl:
raw_name: fld_s16i222
modeling_realm: atm

hus:
raw_name: fld_s30i205
modeling_realm: atm

zg:
raw_name: fld_s30i207
modeling_realm: atm

va:
raw_name: fld_s30i202
modeling_realm: atm

ua:
raw_name: fld_s30i201
modeling_realm: atm

ta:
raw_name: fld_s30i204
modeling_realm: atm

rlus:
raw_name:
- fld_s02i207
- fld_s02i201
- fld_s03i332
raw_name:
- fld_s02i207
- fld_s02i201
- fld_s03i332
- fld_s02i205
modeling_realm: atm

rlds:
raw_name: fld_s02i207
modeling_realm: atm

rsus:
raw_name:
raw_name:
- fld_s01i235
- fld_s01i201
- fld_s01i201
modeling_realm: atm

clivi:
raw_name: fld_s30i406
modeling_realm: atm

evspsbl:
raw_name: fld_s03i223
modeling_realm: atm

hfls:
raw_name: fld_s03i234
modeling_realm: atm

hfss:
raw_name: fld_s03i217
modeling_realm: atm

hur:
raw_name: fld_s30i206
modeling_realm: atm

hurs:
raw_name: fld_s03i245
modeling_realm: atm

huss:
raw_name: fld_s03i237
modeling_realm: atm

prsn:
raw_name: fld_s05i215
modeling_realm: atm

rldscs:
raw_name: fld_s02i208
modeling_realm: atm

rsdt:
raw_name: fld_s01i207
modeling_realm: atm

rsuscs:
raw_name: fld_s01i211
modeling_realm: atm

rsut:
raw_name: fld_s01i208
modeling_realm: atm

rsutcs:
raw_name: fld_s01i209
modeling_realm: atm

sci:
raw_name: fld_s05i270
modeling_realm: atm

sfcWind:
raw_name: fld_s03i230
modeling_realm: atm

sfcWindmax:
raw_name: fld_s03i227_max
modeling_realm: atm

tauu:
raw_name: fld_s03i460
modeling_realm: atm

tauv:
raw_name: fld_s03i461
modeling_realm: atm

ts:
raw_name: fld_s00i024
modeling_realm: atm

ua:
raw_name: fld_s30i201
modeling_realm: atm

uas:
raw_name: fld_s03i209
modeling_realm: atm

va:
raw_name: fld_s30i202
modeling_realm: atm

vas:
raw_name: fld_s03i210
modeling_realm: atm

wap:
raw_name: fld_s30i208
modeling_realm: atm

zg:
raw_name: fld_s30i207
modeling_realm: atm

rls:
raw_name: fld_s02i201
modeling_realm: atm

rss:
raw_name: fld_s01i201
modeling_realm: atm

# ocean

tos:
raw_name: sst
modeling_realm: ocn

so:
raw_name: salt
modeling_realm: ocn

Loading