[ncl-talk] Define and populate plev_bnds in NetCDF

Dennis Shea shea at ucar.edu
Tue Oct 20 16:30:36 MDT 2015


NCL .... A general place to go to get file IO information.

Click 'Examples' .... then 'File I/O' .... Click 'Change netCDF file'

For 'fun' look at other examples also.

===


===

Two approaches:

[1]
If you are familiar withe the netCDF Operators (not associated with
NCL). Use netCDF Operator: ncks   [Use WWW to search for
documentation]

(a) Create a netCDF with the plev_bnds variable:   plev_bnd.nc
      See attached script. Of, course the 'plev' should be changed
      to the appropriate variable name.

(b)  If 'foo.nc' is your base file:
                ncks -O plev.nc  foo.nc
      will append the bounds variable to the file.


[2] NCL direct

   plev_bnds = (/ (/100000, 98750/) \
                         , (/  98750, 96250/) \
                         , (/  91250, 88750/) \

                         , (/ ...  ,    ...   /)  /)          ; last line

              ; name dimensions using NCL syntax
   plev_bnds!0 = "plev"   ; ... whatever is appropriate
   plev_bnds!1 = "pbnd"
   plev_bnds at units = plev at units
   printVarSummary(plev_bnds)


   f = addfile("foo.nc", "w")   ; NOTE the 'w'
   f->plev_bnds = plev_bnds

===
Either way, I would create test files in case there is a problem.

On Tue, Oct 20, 2015 at 12:44 PM, Hertz, Judith A.
(GSFC-606.0)[INTERNATIONAL TECHNOLOGY COALITION, INC]
<judith.a.hertz at nasa.gov> wrote:
> Greetings, NCL’ers
>
> I’m new to NCL. I want to add a variable, plev_bnds, to NetCDF files so that:
>
> double plev_bnds(plev, bnds) ;
>
> data:
>
>  plev_bnds =
>   100000, 98750,
>   98750, 96250,
>   96250, 93750,
>   93750, 91250,
>   91250, 88750,…..
>
> I’ve found addfile, which looks to be a good way to populate the data but the docs say the variable must already exist. Do you know what is the NCL way to create/define a new variable?
>
> thanks,
>
> judy
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mk_plev_bnd.ncl
Type: application/octet-stream
Size: 1421 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151020/8a7f5a63/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plev_bnds.nc
Type: application/x-netcdf
Size: 1024 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151020/8a7f5a63/attachment.nc 


More information about the ncl-talk mailing list