Hello Charlie,
thanks for your answer. I just tried the current cvs version of nco, and
it worked.
My file is several GB in size, and '--xml' simply gave too much
information. When combining it with '--xml -v x,y' (I'm was only
interested in manipulation the x and y axes), the results where better.
With ncdump, I'm used to get all variables and attributes, but values
only for those mentioned with -v x,y. With ncks I only got the
attributes for x and y, but no global attributes (which I really would
need to be CF-compliant), and not the other variables declaration and
attributes.
I'm not sure if I want to have the location="..." tag set. With values
included, the ncml-file is selv-hosted and does not require the original
data-source any longer. But on the other hand - in most cases where I
use ncml, I'm manipulating the ncml-file afterwards, so I can remove it
manually.
Best regards,
Heiko
On 2013-10-15 23:52, Charlie Zender wrote:
Hello Heiko,
An alternative is to use ncks which prints NcML/XML (and CDL)
since NCO version 4.3.3. Although version 4.3.6 (current released
version) only prints XML metadata (like ncdump -x), the current
snapshot prints XML data values as well. It works for netCDF4 files,
variable subsetting, and hyperslabs with the normal NCO switches.
You could install the latest snapshot by following the instructions at
nco.sf.net, or wait a few weeks until the 4.3.7 release.
The results of a typical XML dump follow. Feedback welcome.
cz
zender@givre:~$ ncks --xml ~/nco/data/in_grp.nc
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"
location="/home/zender/nco/data/in_grp.nc">
<dimension name="gds_crd" length="8" />
<dimension name="lat" length="2" />
<dimension name="lev" length="3" />
<dimension name="lon" length="4" />
<dimension name="time" length="10" isUnlimited="true" />
<dimension name="vrt_nbr" length="2" />
<variable name="area" type="float" shape="lat">
<attribute name="units" value="meter2" />
<values>10., 10.</values>
</variable>
<variable name="ilev" type="float" shape="lev vrt_nbr">
<attribute name="purpose" value="Cell boundaries for lev
coordinate" />
<values>0., 300., 300., 750., 750., 1013.25</values>
</variable>
<variable name="lat" type="float" shape="lat">
<attribute name="units" value="degrees_north" />
<values>-90., 90.</values>
</variable>
<variable name="lat_lon" type="float" shape="lat lon">
<values>1., 2., 3., 4., 5., 6., 7., 8.</values>
</variable>
<variable name="lev" type="float" shape="lev">
<attribute name="units" value="hybrid_sigma_pressure" />
<attribute name="bounds" value="ilev" />
<values>100., 500., 1000.</values>
</variable>
<variable name="lon" type="float" shape="lon">
<attribute name="units" value="degrees_east" />
<values>0., 90., 180., 270.</values>
</variable>
<variable name="one" type="float">
<values>1.</values>
</variable>
<variable name="scl" type="float">
<values>1.</values>
</variable>
<variable name="time" type="double" shape="time">
<values>1., 2., 3., 4., 5., 6., 7., 8., 9., 10.</values>
</variable>
<variable name="unique" type="int">
<attribute name="purpose" value="the only variable of this name in
this file, to test smallest possible access requests" />
<values>73</values>
</variable>
<attribute name="Conventions" value="CF-1.0" />
<attribute name="history" value="History global attribute.
" />
<attribute name="julian_day" value="200000.04" />
<attribute name="RCS_Header" value="$Header$" />
<group name="/g1">
<variable name="g1v1" type="int">
<values>1</values>
</variable>
<variable name="lon" type="float" shape="lon">
<attribute name="units" value="degrees_east" />
<values>0., 90., 180., 270.</values>
</variable>
<variable name="scl" type="float">
<values>1.1</values>
</variable>
<variable name="v1" type="int">
<values>1</values>
</variable>
<group name="/g1/g1g1">
<variable name="scl" type="float">
<values>1.11</values>
</variable>
<variable name="v1" type="int">
<values>11</values>
</variable>
</group>
</group>
[et cetera]
</netcdf>