[ncl-talk] query ( CONVERSION ASCII TO NetCDF)

Karin Meier-Fleischer meier-fleischer at dkrz.de
Tue Sep 23 01:58:59 MDT 2014


Hi Kunal,

the answer was given in an earlier mail:

1. read the ASCII data variable, lat and lon
2. create a output file:                         netcdf = 
addfile("simple.nc","c")
3. write your data variable to the output file: ncdf->values = values


Please read the 'output to netcdf' examples for more details:
http://ncl.ucar.edu/Applications/o-netcdf.shtml

Bye,
Karin

Am 23.09.14 07:04, schrieb Kunal Bali:
> Dear NCL users
>
> I am still not getting how to do the conversion from ASCII to netcdf ??
>
> Kunal Bali
> Research Scholar
> Radio & Atmospheric Science Division
> CSIR - National Physical Laboratory
> New Delhi - 110012
>
>
>
>
>
>
> On Mon, Sep 22, 2014 at 7:35 PM, Yuqiang Zhang 
> <yuqiangzhang.thu at gmail.com <mailto:yuqiangzhang.thu at gmail.com>> wrote:
>
>     Hi Kunal,
>
>     In line 30, "*ncl 30> TotCH4_A = data(:,2)* ". You variable
>     "TotCH4_A" is only assigned one dimension's value, so you can't
>     assign two dimension through line 33 & 34.
>
>     Regards,
>
>     Yuqiang
>
>     *From:*ncl-talk-bounces at ucar.edu
>     <mailto:ncl-talk-bounces at ucar.edu>
>     [mailto:ncl-talk-bounces at ucar.edu
>     <mailto:ncl-talk-bounces at ucar.edu>] *On Behalf Of *Kunal Bali
>     *Sent:* Monday, September 22, 2014 8:53 AM
>     *To:* Karin Meier-Fleischer
>     *Cc:* ncl-talk at ucar.edu <mailto:ncl-talk at ucar.edu>
>     *Subject:* Re: [ncl-talk] query ( CONVERSION ASCII TO NetCDF)
>
>     Dear NCL user
>
>     I tried this script from NCL but still getting error
>
>
>     ncl 28> Longitude = data(:,1)
>     ncl 29> Latitude = data(:,0)
>     ncl 30> TotCH4_A = data(:,2)
>     ncl 31> ncdf = addfile("/home/kunal/simple1.nc
>     <http://simple1.nc>","c")
>     ncl 32> filedimdef(ncdf,"time",-1,True)
>     ncl 33> TotCH4_A!0 = "Latitude"
>     ncl 34> TotCH4_A!1 = "Longitude"
>     *fatal:Variable (TotCH4_A) has (1) dimensions can not write to
>     dimension (1)
>     fatal:["Execute.c":8565]:Execute: Error occurred at or near line 34
>     *
>
>
>     Kunal Bali
>
>     Research Scholar
>
>     Radio & Atmospheric Science Division
>
>     CSIR - National Physical Laboratory
>
>     New Delhi - 110012
>
>     On Mon, Sep 22, 2014 at 5:32 PM, Karin Meier-Fleischer
>     <meier-fleischer at dkrz.de <mailto:meier-fleischer at dkrz.de>> wrote:
>
>     Hi Kunal,
>
>     Please, take a look at the 'output netcdf' examples page, method_1
>
>     http://ncl.ucar.edu/Applications/method_1.shtml
>
>     Try this:
>
>     lat = data(:,0)
>
>     lat = data(:,1)
>
>     values= data(:,2)
>
>     system
>     <http://ncl.ucar.edu/Document/Functions/Built-in/system.shtml>("/bin/rm
>     -f simple.nc <http://simple.nc>") ; remove any pre-existing file
>
>     ncdf = addfile("simple.nc  <http://simple.nc>" ,"c") ; output netCDF file
>
>     filedimdef  <http://ncl.ucar.edu/Document/Functions/Built-in/filedimdef.shtml>(ncdf,"time",-1,True) ; recommended
>
>     values!0 = "lat"
>
>     values!1 = "lon"
>
>     values&lat = lat
>
>     values&lon = lon
>
>     ncdf->values = values
>
>     Bye, Karin
>
>
>     Am 22.09.2014 um 11:40 schrieb Kunal Bali <kunal.bali9 at gmail.com
>     <mailto:kunal.bali9 at gmail.com>>:
>
>         Dear NCL users
>
>         I want to convert ASCII to .nc file format. Could any one
>         please provides me the link for this query or give any detail
>         about this ??
>
>         I have data in 3 column ( Latitude Longitude Values)
>
>         More Detail
>
>         *Variable: data
>         Type: float
>         Total Size: 777600 bytes
>                     194400 values
>         Number of Dimensions: 2
>         Dimensions and sizes: [64800] x [3]
>         Coordinates:
>         Number Of Attributes: 1
>           _FillValue : 9.96921e+36
>
>         *
>
>         *So is there any ways to convert ASCII to netcdf format ???*
>
>         *Thank You*
>
>
>         Kunal Bali
>
>         Research Scholar
>
>         Radio & Atmospheric Science Division
>
>         CSIR - National Physical Laboratory
>
>         New Delhi - 110012
>
>         _______________________________________________
>         ncl-talk mailing list
>         List instructions, subscriber options, unsubscribe:
>         http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> _______________________________________________
> 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/20140923/5bac5b73/attachment.html 


More information about the ncl-talk mailing list