[ncl-talk] Regarding writing netcdf file.

Dennis Shea shea at ucar.edu
Thu Jul 4 12:43:41 MDT 2019


PLEASE READ:  *http://www.ncl.ucar.edu/Applications/method_1.shtml*
<http://www.ncl.ucar.edu/Applications/method_1.shtml>

As noted by Dave Allured:

   rh = ....
   rh at long_name = "Relative Humidity"   ; @ to associate attribute with a
variable
   rh at units = "%"

    dir_nc = "./"                       ; output directory  [  ./  ] is
current directory
    fil_nc  = "RH_WRF.nc"
    pth_nc = dir_nc+fil_nc

    *system*
<http://www.ncl.ucar.edu/Document/Functions/Built-in/system.shtml>("/bin/rm
-f "+pth_nc) ; explicitly remove any pre-existing file
    ncdf = addfile (pth_nc,"c")

    f->RHUM = rh

========
Likely, you have to add XLAT, XLONG, TIME variables also.

On Thu, Jul 4, 2019 at 12:02 PM Dave Allured - NOAA Affiliate via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Arshitha,
>
> Here is the simplest possible way to write a netcdf file with one
> attribute.  Try this first.  Use ncdump -h to inspect your output file.
> Suppose you already calculated a variable named "rh" in NCL.
>
>     f = addfile ("filename.nc","c")
>     rh at att1 = "test"
>     f->rhum = rh
>     exit
>
> For more details, please see this documentation:
> https://www.ncl.ucar.edu/Applications/method_1.shtml
>
> --Dave
>
>
> On Thu, Jul 4, 2019 at 9:29 AM arshitha anand via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Dear all,
>>
>> I have an inssue in writing netcdf file.
>> I calculated relative humidity from wrf ouput file. Then I need to write
>> it as a netcdf file.
>> Does anyone know  how to define the attribute  and also, how can I write
>> it as a netcdf file.
>>  Kindly note my script, attached below.
>>
>> Thank you for your suggestions in advance.
>>
>> --
>> *Regards,*
>>
>> *Arshitha Anand K A*
>> Project Associate
>> Department of civil engineering
>> Indian Institute of Technology Madras
>> Chennai - 600036
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190704/22f00a05/attachment.html>


More information about the ncl-talk mailing list