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

New variables #199

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
92baf32
added two new variables: sst and siconc
Oct 7, 2024
d7c1b47
updated siconc units
Oct 8, 2024
fcffcca
Merge branch 'main' into new-variables
aslibese Oct 8, 2024
3f3e778
Update AUTHORS.rst
aslibese Oct 8, 2024
f58d9da
Update AUTHORS.rst
aslibese Oct 8, 2024
556cbc6
add standard_name to raw to allow units conversion
tlogan2000 Oct 8, 2024
c731f10
Merge branch 'new-variables' of github.com:Ouranosinc/miranda into ne…
tlogan2000 Oct 8, 2024
882b469
updated the units of tos and siconc to cmip6 standards
Oct 8, 2024
70522f5
Merge branch 'main' into new-variables
tlogan2000 Oct 8, 2024
3239cc8
use pr standard_name for now
tlogan2000 Oct 9, 2024
70d1e9a
rollback
tlogan2000 Oct 9, 2024
1058d6c
comment out _offset_time (not doing anything ... potentially could re…
tlogan2000 Oct 10, 2024
e4857da
remove _offset_time from ecmwf config; add "era5-single-levels-month…
tlogan2000 Oct 10, 2024
eb12f5c
added the new variable 'land-sea mask (lsm)'
Oct 22, 2024
24c61ea
Merge branch 'new-variables' of https://github.com/Ouranosinc/miranda…
Oct 22, 2024
edadd07
add units correction for raw ERA5 tp data
tlogan2000 Nov 27, 2024
6b1b7a3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 27, 2024
3d857ca
remove transformation unit correction is a rate for monthly
tlogan2000 Nov 27, 2024
762bcf5
added four new variables cp, cape, u, v. removed stlf
Dec 19, 2024
02807b8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Dec 19, 2024
9b966e7
Merge branch 'main' into new-variables
Zeitsperre Jan 3, 2025
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
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Contributors
* Sébastien Biner <[email protected]> `@sbiner <https://github.com/sbiner>`_
* David Huard <[email protected]> `@huard <https://github.com/huard>`_
* Gabriel Rondeau-Genesse <[email protected]> `@RondeauG <https://github.com/RondeauG>`_
* Aslı Beşe <[email protected]> `@aslibese <https://github.com/aslibese>`_
9 changes: 9 additions & 0 deletions src/miranda/convert/_data_corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,14 @@ def _preprocess_correct(d: xr.Dataset, *, ops: list[partial]) -> xr.Dataset:
return ds


def _correct_standard_names(d: xr.Dataset, p: str, m: dict) -> xr.Dataset:
key = "_corrected_standard_name"
for var, val in _iter_entry_key(d, m, "variables", key, p):
if val:
d[var].attrs["standard_name"] = val
return d


def _correct_units_names(d: xr.Dataset, p: str, m: dict) -> xr.Dataset:
key = "_corrected_units"
for var, val in _iter_entry_key(d, m, "variables", key, p):
Expand Down Expand Up @@ -888,6 +896,7 @@ def dataset_corrections(ds: xr.Dataset, project: str) -> xr.Dataset:
metadata_definition = load_json_data_mappings(project)

ds = _correct_units_names(ds, project, metadata_definition)
ds = _correct_standard_names(ds, project, metadata_definition)
ds = _transform(ds, project, metadata_definition)
ds = _invert_sign(ds, project, metadata_definition)
ds = _units_cf_conversion(ds, metadata_definition)
Expand Down
27 changes: 27 additions & 0 deletions src/miranda/convert/data/ecmwf_cf_attrs.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"pev": {
"_cf_variable_name": "evspsblpot",
"_corrected_units": false,
"_corrected_standard_name": "lwe_thickness_of_water_evaporation_amount",
"_invert_sign": {
"era5-land": true,
"era5-single-levels": true,
Expand Down Expand Up @@ -208,6 +209,7 @@
}
},
"_corrected_units": "m",
"_corrected_standard_name": "lwe_thickness_of_precipitation_amount",
"_invert_sign": false,
"_offset_time": {
"era5-land": true,
Expand Down Expand Up @@ -449,6 +451,7 @@
}
},
"_corrected_units": false,
"_corrected_standard_name": "lwe_thickness_of_precipitation_amount",
"_invert_sign": false,
"_offset_time": true,
"_transformation": {
Expand Down Expand Up @@ -501,6 +504,30 @@
"long_name": "Geopotential",
"standard_name": "geopotential",
"units": "m2 s-2"
},
"sst": {
"_cf_variable_name": "tos",
"_corrected_units": false,
"_invert_sign": false,
"_offset_time": false,
"_transformation": false,
"cell_methods": "time: point",
"description": "This parameter (SST) is the temperature of sea water near the surface. In ERA5, this parameter is a foundation SST, which means there are no variations due to the daily cycle of the sun (diurnal variations).",
"long_name": "Sea surface temperature",
"standard_name": "sea_surface_temperature",
"units": "degC"
},
"siconc": {
"_cf_variable_name": "siconc",
"_corrected_units": "1",
"_invert_sign": false,
"_offset_time": false,
"_transformation": false,
"cell_methods": "time: point",
"description": "This parameter is the percentage of a grid box which is covered by sea ice. Sea ice can only occur in a grid box which includes ocean or inland water according to the land-sea mask and lake cover, at the resolution being used.",
"long_name": "Sea ice area percentage",
"standard_name": "sea_ice_area_fraction",
"units": "%"
}
}
}