Changing values in a .nc file

Dave Allured dave.allured at NOAA.GOV
Mon Jun 12 15:27:27 EDT 2006


Mark,

1.  If the solution was previously posted to this users list, then
please consult the archives for the previous messages.  This is why we
like answers to be posted publicly as much as possible.

   http://list.cineca.it/archives/gradsusr.html

2.  Do you have the ncgen utility?  It is a standard part of the Netcdf
library, which you should have installed.

ncgen translates ascii files in "CDL" format into Netcdf files, which
are then easily read by Grads.  The core of CDL format is arrays of
numbers as comma separated values.  If you have ncgen, and you can
insert a comma after each number in your simple text file, then there is
no need to retype any of it.  You will just need to add a fairly simple
text CDL header, which declares the dimensions and the variable names.

I believe that ncgen and CDL documentation can be found on the Netcdf
website.  HTH.

--Dave A.
CIRES Climate Diagnostics Center
NOAA Earth System Research Laboratory, Physical Sciences Division

Mark Schus wrote:
> Hi all,
>
> I had asked this problem before, and someone sent me a solution, but this
> was months ago, and now I have to do the same calculation again, but I
> have forgotten how to.
>
> I need to make a contour plot in grads for a region in NW Canada, but I
> want to use my own values that are in a simple text file.  I don't know
> how to read in values, but someone suggested that I create a 2D plot of
> surface pressure from a .nc file, and then manually change all of the
> values in that file to the ones that I would like to plot.
>
> Can anyone tell me how to change point values?
>
> For example, if I do
>
> set lat 50
> set lon 210
> d pres
>
> and the values is 101300 Pa, how can I change it so that it will be
> something like 2.54?  Is it even possible?  I would like to manually
> change every point so that I can have my own contour plot.  I can do this
> in Excel, but then I won't have the nice topography background which grads
> has.
>
> Thanks for any help,
>
> Mark
>



More information about the gradsusr mailing list