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

formula terms issue; bounds attribute missing for b variable #177

Closed
ehogan opened this issue May 24, 2017 · 8 comments
Closed

formula terms issue; bounds attribute missing for b variable #177

ehogan opened this issue May 24, 2017 · 8 comments
Assignees
Milestone

Comments

@ehogan
Copy link
Contributor

ehogan commented May 24, 2017

When using CMOR to produce, e.g. cli, the output netCDF file contains, along with the cli data variable and coordinate variables, orog, b and b_bnds variables. However, the b variable (see the CMIP6_formula_terms.json MIP table) does not have a bounds attribute indicating that b_bnds are the bounds for b in the same way as the lev coordinate variable (see the CMIP6_coordinate.json MIP table):

variables:
        [...]
	double lev(lev) ;
		lev:bounds = "lev_bnds" ;
		lev:units = "m" ;
		lev:axis = "Z" ;
		lev:positive = "up" ;
		lev:long_name = "hybrid height coordinate" ;
		lev:standard_name = "atmosphere_hybrid_height_coordinate" ;
		lev:formula = "z = a + b*orog" ;
		lev:formula_terms = "a: lev b: b orog: orog" ;
	double lev_bnds(lev, bnds) ;
		lev_bnds:formula = "z = a + b*orog" ;
		lev_bnds:standard_name = "atmosphere_hybrid_height_coordinate" ;
		lev_bnds:units = "m" ;
		lev_bnds:formula_terms = "a: lev_bnds b: b_bnds orog: orog" ;
	double b(lev) ;
		b:long_name = "vertical coordinate formula term: b(k)" ;
		b:missing_values = 1.00000002004088e+20 ;
		b:_FillValue = 1.00000002004088e+20 ;
	float orog(lat, lon) ;
		orog:long_name = "Surface Altitude" ;
		orog:units = "m" ;
		orog:missing_values = 1.e+20f ;
		orog:_FillValue = 1.e+20f ;
	double b_bnds(lev, bnds) ;
		b_bnds:long_name = "vertical coordinate formula term: b(k+1/2)" ;
		b_bnds:missing_values = 1.00000002004088e+20 ;
		b_bnds:_FillValue = 1.00000002004088e+20 ;
        [...]

The formula_terms attribute for the lev_bnds variable certainly expects bounds for b; would it be possible for CMOR to add the appropriate bounds attribute to all the formula terms-related variables?

@taylor13
Copy link
Collaborator

@ehogan There are certainly several things to clear up here. Before modifying CMOR, we should review the recent discussion in the CF conventions on the proper way to store bounds associated with formulas. This is just now being finalized. See https://cf-pcmdi.llnl.gov/trac/ticket/140#comment:22

@taylor13
Copy link
Collaborator

@ehogan On further review, I think the file above is consistent with the proposed treatment of formula terms bounds. The idea is that bounds apply to coordinates (i.e. lev(lev)). If you want to transform from the level to a location in space, you rely on the formula terms associated with those levels. In the case of lev_bnds, you would use the formula terms named by the lev_bnds attribute. There is no need to look up the b_bnds if you're only considering b, so there is no need for a bounds attribute attached to b. Note CF says it is o.k. to associate bounds with b, but this is not necessary.

@ehogan
Copy link
Contributor Author

ehogan commented May 24, 2017

See https://cf-pcmdi.llnl.gov/trac/ticket/140#comment:22

Interesting read, thanks for the link! :)

@ehogan
Copy link
Contributor Author

ehogan commented May 24, 2017

@taylor13 thank you for the clarification :)

@ehogan ehogan closed this as completed May 24, 2017
@taylor13
Copy link
Collaborator

@dnadeau4 Actually, there are a few things that should be cleaned up in the above file. formula_terms should never have missing values, so missing_values and _Fill_values could be removed.

Perhaps more importantly, the way CMOR defines missing values for double precision variables needs to be corrected. [talking in fortran terminology] Currently, it seems to set these by defining a float number as 1.0e20 and then converting that to a double precision number. instead, it should set missing_value for double precision variables to 1.0d20. Then you would get a more precise representation of 100,000,000,000,000,000,000.

We also for CMIP6 need for the first time to define missing values for integer variables, which again are not currently handled correctly by CMOR (I think).

@dnadeau4
Copy link
Collaborator

I think you are right, the missing_value is cast from a float to double and and the precision suffer.

I'll check the integer missing_value cmor code. Not sure how this was handle.

@dnadeau4 dnadeau4 reopened this May 24, 2017
@dnadeau4 dnadeau4 self-assigned this May 24, 2017
@dnadeau4 dnadeau4 added this to the 3.2.4 milestone May 24, 2017
@dnadeau4 dnadeau4 modified the milestones: 3.2.5, 3.2.4 Jun 16, 2017
@dnadeau4
Copy link
Collaborator

I just fix this in branch 3.2.5. @taylor13 Can you tell me more about INTEGER missing_value?
I cannot find any code about this.

@dnadeau4 dnadeau4 modified the milestones: 3.2.6, 3.2.5 Aug 30, 2017
@dnadeau4
Copy link
Collaborator

We fixed formula_terms missing values and the history log. Will reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants