Comments (17)
🔝 I'll do it !!
from esmvalcore.
@bouweandela I tested again a recipe with chl data from CMIP6 models and it worked fine.
from esmvalcore.
The problem here is the assumption that table.frequency
is defined also in the header
section of CMIP6 tables, but it was changed in favor of having frequency
defined for each variable.
The solution is to modify ESMValTool/esmvaltool/cmor/table.py
as follow
@@ -102,15 +102,16 @@ class CMIP6Info(object):
self.tables[table.name] = table
generic_levels = header['generic_levels'].split()
- table.frequency = header.get('frequency', '')
table.realm = header.get('realm', '')
for var_name, var_data in raw_data['variable_entry'].items():
var = VariableInfo('CMIP6', var_name)
if 'frequency' in var_data:
var.frequency = var_data['frequency']
+ table.frequency = var.frequency
else:
- var.frequency = table.frequency
+ raise ValueError('missing frequency for var ' +
+ var_name + ' in ' + header['table_id'])
var.read_json(var_data)
self._assign_dimensions(var, generic_levels)
table[var_name] = var
I tested it and it only requires the removal of ESMValTool/esmvaltool/cmor/tables/cmip6/Tables/CMIP6_CFsubhrOff.json
that is obsolete and no more included in CMOR tables (I missed that in the previous update PR)
I think it should be ok coded in this way :
- still define
table.frequency
based on variables (by construction they have all the same freq within a table) in order to be compatible with CMIP5 table definition and its use in code workflow. - a safety control on frequency definition for each variable
@valeriupredoi @mattiarighi Any suggestion on how to implement the bugfix?
from esmvalcore.
This seems to affect obs4mips
data as well. I get exactly the same error with the GPCP-SG
and CERES-EBAF
datasets.
from esmvalcore.
for chl
in CMIP6_Omon.json
"chl": {
"frequency": "mon",
we can't hack CMOR tables, if they are obsolete then we update those via git rather than hacking them manually.
Can you provide a minimal recipe that I can use to reproduce this issue pls? 🍺
from esmvalcore.
ah no need to worry about a recipe example, it fails straight away for tas
as well - question is - has the current implementation worked at__all for CMIP6 data?
from esmvalcore.
it works if you add it in the recipe: frequency: mon
, so worst case scenario we add it in recipe than we change the CMOR tables, but am looking at a more respectable change at the mo 😁
from esmvalcore.
for
chl
inCMIP6_Omon.json
"chl": { "frequency": "mon",
we can't hack CMOR tables, if they are obsolete then we update those via git rather than hacking them manually.
Can you provide a minimal recipe that I can use to reproduce this issue pls? 🍺
@valeriupredoi My bad!! I forgot to say that with the correction proposed there is no need to hack cmor tables.
from esmvalcore.
ah no need to worry about a recipe example, it fails straight away for
tas
as well - question is - has the current implementation worked at__all for CMIP6 data?
Yes, ~ one week ago I successfully ran this:
from esmvalcore.
OK here's the bugger: in table.py
: table.frequency = header.get('frequency', '')
-- problem is in the latest CMIP6 tables the Header member does not contain the frequency anymore but it is specified at variable levels; also the same variable shows up in different modeling realms and the realm is treated as a single concatenated string; I changed it a bit like this:
def _load_table(self, json_file):
with open(json_file) as inf:
raw_data = json.loads(inf.read())
if not self._is_table(raw_data):
return
table = TableInfo()
header = raw_data['Header']
table.name = header['table_id'][6:].split('_')[-1]
self.tables[table.name] = table
generic_levels = header['generic_levels'].split()
table.realm = header.get('realm', '').split()
for var_name, var_data in raw_data['variable_entry'].items():
for realm in table.realm:
if var_data['modeling_realm'] == realm:
var = VariableInfo('CMIP6', var_name)
if 'frequency' in var_data:
frequency = var_data['frequency']
else:
frequency = header.get('frequency', '')
var.read_json(var_data)
var.frequency = frequency
var.modeling_realm = realm
self._assign_dimensions(var, generic_levels)
table[var_name] = var
and I checked that the table
instance returned does indeed contain a valid frequency
, but I still get the checker fail, the problem should be spread to the checker as well....I'll look more into it tomorrow
from esmvalcore.
@valeriupredoi Why not to try to simply force assignment of frequency
to the table as I did in the solution proposed above. Here below a simple addition to your code ...
if var_data['modeling_realm'] == realm:
var = VariableInfo('CMIP6', var_name)
if 'frequency' in var_data:
frequency = var_data['frequency']
else:
frequency = header.get('frequency', '')
var.read_json(var_data)
var.frequency = frequency
var.modeling_realm = realm
+ table.frequency = frequency
As part of previous consideration, this assignment should be kept to avoid compatibility issue with CMIP5 tables.
The obsolete table I was referring (ESMValTool/esmvaltool/cmor/tables/cmip6/Tables/CMIP6_CFsubhrOff.json
) was removed from the CMOR repository and it is a leftover from PR #937 that need to be removed as well.
from esmvalcore.
hey @tomaslovato and @mattiarighi have a look at this one ESMValGroup/ESMValTool#985 and test please, when you gots time, I will fix the test as soon as I hear you guys had success testing!
@tomaslovato cheers for the suggestion - have a look at the code changes in the PR pls, it is pretty much just as you suggest, only that the table gets forced a frequency
attribute depending on var and mip right before the table is passed over to the checks
from esmvalcore.
hey @tomaslovato and @mattiarighi have a look at this one #985 and test please, when you gots time, I will fix the test as soon as I hear you guys had success testing!
@tomaslovato cheers for the suggestion - have a look at the code changes in the PR pls, it is pretty much just as you suggest, only that the table gets forced afrequency
attribute depending on var and mip right before the table is passed over to the checks
from esmvalcore.
But why is this affecting obs4mips
as well?
We didn't change those tables, did we?
from esmvalcore.
from esmvalcore.
dereferencing ESMValTool closed PR #985 and referencing #158
from esmvalcore.
@tomaslovato It looks like this issue may have been solved. Can you confirm this?
from esmvalcore.
Related Issues (20)
- Add `esmvaltool compare` command to run `esmvaltool/utils/testing/regression/compare.py` HOT 4
- GFDL-CM4 SfcWind height Issues HOT 1
- [testing/mamba] No useful output from mamba
- Improve the ESMValCore release documentation
- Automatically select a lazy regridding scheme in `regrid` preprocessor function for 2D lat/2D lon grids when possible HOT 6
- Drop support for Python 3.9 HOT 3
- Update Iris pin to avoid using versions with memory issues HOT 4
- Increase the version number for 2.11.0 release
- Add draft release notes for v2.11.0rc1 HOT 1
- Remove `compilers` from `environment.yml`
- Recipe test results for ESMValCore v2.11.0rc1 HOT 15
- Diagnostic failure for `recipe_martin18grl.yml` on `v2.11.0rc1` HOT 1
- Diagnostic failure for `recipe_pcrglobwb.yml` on `v2.11.0rc1` HOT 1
- Diagnostic failure for `recipe_lauer22jclim_fig3-4_zonal.yml` on `v2.11.0rc1` HOT 1
- Add native6, OBS6 and RAWOBS rootpaths to metoffice config-user.yml template, and remove temporary dir
- Add control over chunks at load time
- Interpolation in `resample_hours`
- Adding ETCCDI custom CMOR tables for HadEX3 CMORizer and IPCC diagnotics HOT 1
- Make extract_point/extract_location/extract_coordinate_points preprocessor functions lazy HOT 1
- Lazy derive preprocessor function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esmvalcore.