Re: [netcdfgroup] ncdump -x -v (Heiko Klein)

Thanks for your feedback:

When you use the -v switch NCO anticipates that the user
wants to "focus in" on those variables, so it omits global metadata.
The switches to activate all metadata printing
while subsetting variables are -M -m -H:

ncks --xml -m -M -H -v time ~/nco/data/in.nc

see http://nco.sf.net/nco.html#prn_tbl

Yes, the location tag could be more flexible:
whether it exists at all, uses "file:", and/or relative paths.
These may be implemented if/when users request them.
I would welcome a summary of what the switches should be.
For now, the current snapshot includes an --xml_no_location switch
to omit the location tag. Please post NCO-focused followups
to sourceforge not to Unidata's netCDF list.

cz

zender@roulee:~$ ncks --xml --xml_no_location -M -m -H -v time
~/nco/data/in.nc
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2";>
    <dimension name="time" length="10" isUnlimited="true" />
    <dimension name="vrt_nbr" length="2" />
    <variable name="time" type="double" shape="time">
      <attribute name="long_name" value="time" />
      <attribute name="units" value="days since 1964-03-12 12:09:00
-9:00" />
      <attribute name="calendar" value="gregorian" />
      <attribute name="bounds" value="time_bnds" />
      <values>1., 2., 3., 4., 5., 6., 7., 8., 9., 10.</values>
    </variable>
    <variable name="time_bnds" type="float" shape="time vrt_nbr">
      <attribute name="purpose" value="Cell boundaries for time
coordinate" />
      <values>0.5, 1.5, 1.5, 2.5, 2.5, 3.5, 3.5, 4.5, 4.5, 5.5, 5.5,
6.5, 6.5, 7.5, 7.5, 8.5, 8.5, 9.5, 9.5, 10.5</values>
    </variable>
    <attribute name="Conventions" value="CF-1.0" />
    <attribute name="history" value="History global
attribute.&#xA;Attributes like this often have embedded newlines to
enhance legibility.&#xA;Such newlines should serve as linebreaks on the
screen, hence,&#xA;friendly CDL converters print a single NC_CHAR
attribute as a comma-separated list of strings&#xA;where each embedded
delimiter marks a linebreak.&#xA;Otherwise it would be harder for humans
to read the CDL." />
    <attribute name="julian_day" value="200000.04" />
    <attribute name="RCS_Header" value="$Header$" />
</netcdf>

Le 16/10/2013 04:06, Heiko Klein a écrit :
> 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.&#xA;" />
>>      <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>
>>
> 

-- 
Charlie Zender, Earth System Sci. & Computer Sci.
University of California, Irvine 949-891-2429 )'(



  • 2013 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: