Hi Daniel,
you need to replace the "." with @
the "." in ncap2 is used to specify a ncap2 method.
e.g
SURF_ugN_NOX@coordinates="abc";
or
'global@'SURF_ugN_NOX.coordinates'.ram_delete();
To use the "." in a name you need to quote the var/att name with "'" as I have done above.
...Henry
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
you need to replace the "." with @
the "." in ncap2 is used to specify a ncap2 method.
e.g
SURF_ugN_NOX@coordinates="abc";
or
'global@'SURF_ugN_NOX.coordinates'.ram_delete();
To use the "." in a name you need to quote the var/att name with "'" as I have done above.
Unfortunately, both solutions do not work (global@SURF_ugN_NOX@coordinates and 'global@'SURF_ugN_NOX.coordinates'; see bottom of this post). Probably, I explained my issue wrongly. This is my cdl file definition:
All attributes of each variable are duplicated as global attributes due to an issue with a THREDDS server, from which I downloaded these data. I want to remove the duplicate global attributes.
Here is, what I tried in ncap2 scripts. The comment lines indicate the resulting error.
global@SURF_ugN_NOX.coordinates.ram_delete();/* test2.ncap:1:14: expecting FUNC, found 'coordinates' */global@'SURF_ugN_NOX.coordinates'.ram_delete();/* testA.ncap line 1, column 11: unexpected character 'g' */global@"SURF_ugN_NOX.coordinates".ram_delete();/* testA.ncap line 1, column 11: unexpected character 'g' */global@`SURF_ugN_NOX.coordinates`.ram_delete();/* testA.ncap line 1, column 11: unexpected character 'g' */global@SURF_ugN_NOX\.coordinates.ram_delete();/* testA.ncap line 1, column 23: unexpected character '\' */global@SURF_ugN_NOX@coordinates.ram_delete();/* test2.ncap:1:13: unexpected token: global@coordinates */'global@'SURF_ugN_NOX.coordinates'.ram_delete();/* testA.ncap line 1, column 12: unexpected character ''' */
Last edit: Daniel Neumann 2019-01-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey,
Happy new year!
Some global attributes of a netCDF I am working with contain a dot in their name. E.g.:
I would like to work with these global attributes in a ncap2 scripts. But none of these solutions work:
Does there exist a workaround? Or should I rename these attributes first -- e.g. with
ncatted
.Cheers,
Daniel
Hi Daniel,
you need to replace the "." with @
the "." in ncap2 is used to specify a ncap2 method.
e.g
SURF_ugN_NOX@coordinates="abc";
or
'global@'SURF_ugN_NOX.coordinates'.ram_delete();
To use the "." in a name you need to quote the var/att name with "'" as I have done above.
...Henry
Hi Henry,
Thanks for the quick reply.
Unfortunately, both solutions do not work (
global@SURF_ugN_NOX@coordinates
and'global@'SURF_ugN_NOX.coordinates'
; see bottom of this post). Probably, I explained my issue wrongly. This is my cdl file definition:All attributes of each variable are duplicated as global attributes due to an issue with a THREDDS server, from which I downloaded these data. I want to remove the duplicate global attributes.
Here is, what I tried in ncap2 scripts. The comment lines indicate the resulting error.
Last edit: Daniel Neumann 2019-01-04
Actually, I am confused about the usage of
ram_delete()
. I understood the definitionas delete a RAM variable or delete any attribute (not a newly created attribute). But
yields