-
Notifications
You must be signed in to change notification settings - Fork 49
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
Fix cell_methods in Example 7.13 #587
Comments
To me this looks like an array of strings, something that is currently discussed elsewhere (can't find the issue/discussion just now). |
Yes - a quick test suggests that this is indeed how CDL represents an attribute that is a vector of strings, though such attributes are prefix with # Python
import netCDF4
n = netCDF4.Dataset('test.nc', "w", format="NETCDF4")
n.Conventions = "CF-1.12"
n.vector = ['a', 'bb']
n.close() and its CDL looks like: $ ncdump test.nc
netcdf test {
// global attributes:
:Conventions = "CF-1.12" ;
string :vector = "a", "bb" ;
} So, as things currently stand I think that example 7.13 is defective, and the I found one of the issues discussing vector string: https://github.com/orgs/cf-convention/discussions/341. That issue is about global attributes only. There are are other aspects when considering vector variable attributes, but I can't find the discussion on that one right now, either. David |
Thank you both. So would the correct syntax be?
The description of Example 7.13 reads: Temperature for each hour of the typical climatological day Someone with expertise of |
Hi Thomas, I think your corrected version looks good - thanks. I think it's safe to marks this issue as a As an aside, and as far as I'm aware, in CDL you can split a string across multiple lines, but the result is a string new-line characters inserted: $ cat test2.cdl
netcdf test {
// global attributes:
:Conventions = "CF-1.12" ;
string :vector = "a", "bb" ;
:cell_methods =
"time: mean within days
time: mean over days
time: mean over years";
}
$ ncgen -knc4 -o test2.nc test2.cdl
$ ncdump test2.nc
netcdf test2 {
// global attributes:
:Conventions = "CF-1.12" ;
string :vector = "a", "bb" ;
:cell_methods = "time: mean within days\n time: mean over days\n time: mean over years" ;
} |
The NUG says
By "character" attribute it means type Thanks, Thomas and David. |
TitleFix Moderator@davidhassell (?) Requirement SummaryAttribute Technical Proposal SummaryChange the value of the cell_methods attribute to "time: mean within days time: mean over days time: mean over years" Associated pull requestPR #591 |
Thanks, Thomas. The PR look good to me. |
Since this is a defect issue, it will be accepted if no-one raises any objection in three weeks, before 1st March. Thanks, Thomas. |
I have a (maybe stupid) question on Example 7.13. Below I reproduce the main variable in this.
Here we see that
:cell_methods
is over two strings, with a ',' linking the two. I am wondering if this is valid CDL syntax? In any case (valid or not), would the example be easier to read if:cell_methods
was a single string?The text was updated successfully, but these errors were encountered: