[gradsusr] convertion of netCDF file into binary

James T. Potemra jimp at hawaii.edu
Wed May 18 15:55:29 EDT 2016


Lekshmi,

There might be a problem with the resolution.  You are better off using 
"set x 1 135" and "set y 1 129" instead of "set lon 66.5 100" and "set 
lat 6.5 38.5".  As a simple check, your created file should be 
4*135*129*66; I suspect it might not be (you are likely not getting 135 
lons and 129 lats).

Also, I'm not sure if it matters, but your control file seems to mix 
syntax.  You have "rainfall 0 t,x,y Rainfall" which works for netcdf 
files, but I don't think the (t,x,y) is needed for GrADS binary files.

Jim


On 5/17/16 8:03 PM, Lekshmi Mudra wrote:
> Before using sdfwrite, i tried 'fwrite'. The resultant binary file is
> not working. Here i'm attaching gs file for extracting monthly data
> from nc file and respective .ctl file for the monthly data.
>
> Below given are the details of .nc file for IMD rainfall from 1948-2015
> Grid coordinates :
>       1 : lonlat       > size      : dim = 17415  nx = 135  ny = 129
>                          lon       : first = 66.5  last = 100  inc =
> 0.25  degrees_east
>                          lat       : first = 6.5  last = 38.5  inc =
> 0.25  degrees_north
>     Vertical coordinates :
>       1 : surface                  : 0
>     Time coordinate :  816 steps
> ga-> q file
> File 1 : Monthly cumulative rainfall
>    Descriptor: IMD_Precip_1948-2015.nc
>    Binary: IMD_Precip_1948-2015.nc
>    Type = Gridded
>    Xsize = 135  Ysize = 129  Zsize = 1  Tsize = 816  Esize = 1
>    Number of Variables = 1
>       rainfall  0  t,y,x  Rainfall
>
>
> Thank you all for the suggestions.
>
>
>
>
>
>
>
>
>
>
> On 5/18/16, Jayakrishnan P.R <prjayakrishnan at gmail.com> wrote:
>> Share your gs file along with the ctl file which you used for opening the
>> converted binary file so that someone can have a look into it for error. As
>> already pointed out by users, sdfwrite is for writing a file into netcdf
>> format.  Here is a sample gs file which can be used for converting OLR into
>> .bin file. Have a look and modify it for your purpose. Best of Luck.
>>
>> 'reinit'
>> 'sdfopen D:/computation2008/IITM_OLR_2008.nc'
>> 'set lon 62 72'
>> 'set lat 5 15'
>> prompt 'key-in file name for olr : '
>> pull fname
>> 'set fwrite 'fname
>> tt=153
>> 'set t 'tt
>> 'set gxout fwrite'
>> 'd olr'
>> 'disable fwrite'
>>
>>
>>
>> On Tue, May 17, 2016 at 8:59 PM, Mikovitz, Colleen (LARC-E302)[SCIENCE
>> SYSTEMS AND APPLICATIONS, INC] <j.c.mikovitz at nasa.gov> wrote:
>>
>>> The sdfwrite is for writing into another .nc file (sdf=self-describing
>>> format).
>>>
>>> Use ‘set gxout fwrite’  along with ‘set fwrite’   Check out the
>>> documentation on http://cola.gmu.edu/grads/gadoc/gadocindex.html for each
>>> of those.
>>>
>>> As a tip, make sure your x and y are set exactly to what you want output.
>>> For example, ‘set x 1 360’ for a one-degree grid.
>>>
>>> Colleen
>>>
>>> On May 17, 2016, at 6:18 AM, Lekshmi Mudra <lekshmimdr at gmail.com> wrote:
>>>
>>>> Dear All,
>>>>
>>>>          I have all India gridded (0.25 x 0.25) imd rainfall data from
>>>> 1948 to 2015, which is in .nc format. I wanted to convert the same
>>>> into .bin format. I have tried using sdfwrite command. The resulted
>>>> binary file is not working properly.
>>>> Is there any solution?
>>>>
>>>>
>>>>
>>>> Lekshmi Mudra
>>>> _______________________________________________
>>>> gradsusr mailing list
>>>> gradsusr at gradsusr.org
>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>
>>
>>
>> --
>> Sincerely
>>
>> **************************************************
>> Dr. Jayakrishnan P.R
>> Post Doctoral Research Fellow
>> C308, Institute of Ocean and Earth Sciences (IOES)
>> University of Malaya
>> 50603, Kuala Lumpur
>> Tel: (+603) 7967 4640 / 6995
>> Mobile: 012-3526094
>>
>> ****************************************************
>>
>>
>>
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20160518/8d35e2ce/attachment.html 


More information about the gradsusr mailing list