[ncl-talk] Netcdf time dimension to CSV

azizul haque haque.azizul320 at yahoo.com
Fri Sep 26 04:30:58 MDT 2014


Its now work, Thank you very much


On Thursday, 25 September 2014, 6:48, Mary Haley <haley at ucar.edu> wrote:
 


If I understand what you're asking, then "write_table" is probably what you need:

http://www.ncl.ucar.edu/Document/Functions/Built-in/write_table.shtml


See the "examples" section.

Or, a very simple script:

years  = (/2006,2006,2006/)
months = (/   1,    1,   1/)
days   = (/   1,    2,   3/)
ntime  = dimsizes(years)
lines = new(ntime+1,string)
;---header
lines(0) = "year,month,day"
;--rest of values
do i=0,ntime-1
  lines(i+1) = str_join((/years(i),months(i),days(i)/),",")
end do
asciiwrite("test.csv",lines)

Or, see other ASCII writing examples at:

http://www.ncl.ucar.edu/Applications/o-ascii.shtml


--Mary


On Wed, Sep 24, 2014 at 1:51 AM, azizul haque <haque.azizul320 at yahoo.com> wrote:

Hi NCL User,
>I need to convert a netcdf time dimension to csv in the following excel format. Your suggestion are highly appreciated.
>
>
>Regards
>Azizul
>year                                                 month                            day                 precipitation
>
>
>2006 1 1 1.84E-02 
>2006 1 2 1.64E-01 
>2006 1 3 7.19E-04 
>2006 1 4 1.10E-03 
>2006 1 5 1.64E-03 
>2006 1 6 1.04E-03 
>2006 1 7 1.50E-03 
>2006 1 8 1.90E-03 
>2006 1 9 2.03E-01 
>2006 1 10 5.19E-01 
>2006 1 11 1.30E-01 
>2006 1 12 1.34E-02 
>2006 1 13 2.46E-03 
>2006 1 14 2.12E-03 
>2006 1 15 2.27E-03 
>2006 1 16 2.50E-03 
>2006 1 17 1.62E-03 
>2006 1 18 1.10E-03 
>2006 1 19 1.11E-03 
>_______________________________________________
>ncl-talk mailing list
>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/20140926/2d4695e7/attachment.html 


More information about the ncl-talk mailing list