Changes between Version 1 and Version 2 of NCMLUserStories


Ignore:
Timestamp:
Apr 28, 2016 5:16:49 PM (6 years ago)
Author:
maru
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NCMLUserStories

    v1 v2  
    11In this page we include several examples of how to use the NcML files.
     2
     3== EXAMPLES ==
     4* '''How to modify the values of a variable in a netcdf file?'''
     5   Ncml could be a useful tool to manipulate netcdf files. In this example, we are going to describe how to modify the values of a particular variable (rlat) in an existing netcdf file (tas.nc).
     6
     7   For this purpuse it is necessary to generate a ncml that refers to that particular netcdf, by adding a location argument. Then, we just need to specify the variable name that we want to change, their values  and the separator between them. The ncml file will look something like this:
     8{{{
     9<?xml version="1.0" encoding="UTF-8"?>
     10<ncml:netcdf xmlns:ncml="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" location="tas.nc">
     11    <ncml:variable name="rlat">
     12    <ncml:values separator=",">
     13                0.883846282958984, 1.10384750366211, 1.32384872436523, 1.54384613037109, 1.76384735107422, 1.98384857177734, 2.2038459777832, 2.42384719848633, 2.64384841918945, 2.86384773254395, 3.08384704589844, 3.30384826660156, 3.52384757995605, 3.74384689331055, 3.96384811401367, 4.18384742736816, 4.40384674072266, 4.62384796142578, 4.84384727478027, 5.06384658813477, 5.28384780883789, 5.50384712219238, 5.72384834289551, 5.94384765625, 6.16384696960449, 6.38384819030762, 6.60384750366211, 6.8238468170166, 7.04384803771973, 7.26384735107422, 7.48384666442871,7.70384788513184, 7.92384719848633, 8.14384841918945, 8.36384773254395, 8.58384704589844, 8.80384826660156, 9.02384757995605, 9.24384689331055, 9.46384811401367, 9.68384742736816, 9.90384674072266, 10.1238479614258, 10.3438472747803, 10.5638465881348, 10.7838478088379, 11.0038471221924, 11.2238483428955, 11.44384765625, 11.6638469696045, 11.8838481903076, 12.1038475036621, 12.3238468170166, 12.5438480377197, 12.7638473510742, 12.9838466644287, 13.2038478851318, 13.4238471984863, 13.6438484191895, 13.8638477325439, 14.0838470458984, 14.3038482666016, 14.5238475799561, 14.7438468933105, 14.9638481140137, 15.1838474273682, 15.4038467407227, 15.6238479614258, 15.8438472747803, 16.0638465881348, 16.2838478088379, 16.5038471221924, 16.7238483428955, 16.94384765625, 17.1638469696045, 17.3838481903076, 17.6038475036621, 17.8238468170166, 18.0438480377197, 18.2638473510742, 18.4838466644287, 18.7038478851318, 18.9238471984863, 19.1438484191895, 19.3638477325439, 19.5838470458984, 19.8038482666016, 20.0238475799561, 20.2438468933105, 20.4638481140137, 20.6838474273682, 20.9038467407227, 21.1238479614258, 21.3438472747803, 21.5638465881348, 21.7838478088379, 22.0038471221924, 22.2238464355469, 22.44384765625, 22.6638469696045, 22.883846282959, 23.1038475036621, 23.3238487243652, 23.5438461303711, 23.7638473510742, 23.9838485717773, 24.2038478851318, 24.4238471984863, 24.6438484191895, 24.8638477325439, 25.0838470458984, 25.3038482666016, 25.5238475799561, 25.7438468933105, 25.9638481140137, 26.1838474273682, 26.4038467407227, 26.6238479614258, 26.8438472747803, 27.0638465881348, 27.2838478088379, 27.5038471221924, 27.7238464355469, 27.94384765625, 28.1638469696045, 28.383846282959, 28.6038475036621, 28.8238468170166, 29.0438480377197, 29.2638473510742, 29.4838485717773, 29.7038478851318, 29.9238471984863, 30.1438484191895, 30.3638477325439, 30.5838470458984, 30.8038482666016, 31.0238475799561, 31.2438468933105, 31.4638481140137, 31.6838474273682, 31.9038467407227, 32.1238479614258, 32.3438491821289, 32.5638465881348, 32.7838478088379, 33.003849029541, 33.2238464355469, 33.44384765625, 33.6638488769531, 33.883846282959, 34.1038475036621, 34.3238487243652, 34.5438461303711, 34.7638473510742, 34.9838485717773, 35.2038459777832, 35.4238471984863, 35.6438484191895, 35.8638458251953, 36.0838470458984, 36.3038482666016, 36.5238456726074, 36.7438468933105, 36.9638481140137, 37.1838455200195, 37.4038467407227
     14                </ncml:values>
     15  </ncml:variable>
     16</ncml:netcdf>
     17}}}
     18   In order to save the changes in a new netcdf file, we can use toolsUI.
     19{{{
     20java -cp /software/meteo/jar/toolsUI-4.6.5.jar ucar.nc2.write.Nccopy --input rlat_new.ncml --output tas_new.nc --format netcdf4_classic -d 4 -sh
     21}}}