[gradsusr] convertion of netCDF file into binary

Lekshmi Mudra lekshmimdr at gmail.com
Wed May 18 04:43:05 EDT 2016


I tried the same and got the binary data. The .ctl file prepared for
the same is opening in grads, but the plott displaying is wrong. There
is some problem in contouring, but how it is occuring that i'm not
understanding.

Thank you.

On 5/18/16, Jayakrishnan P.R <prjayakrishnan at gmail.com> wrote:
> Try this one. Why 'define january=rainfall' and 'd rainfall' ??.....instead
> of d january ?.. Also the set time 'set time Jan1950 Dec2015'
> statement is inactive inside he loop. I removed that also. If still error,
> then try with set x and set y.
>
> 'reinit'
> 'c'
> 'sdfopen IMD_Precip_1948-2015.nc'
> 'set lat 6.5 38.5'
> 'set lon 66.5 100'
> 'set fwrite jan.bin'
> tt=25
> while(tt<=816)
> 'set t 'tt
> 'set gxout fwrite'
> 'd rainfall'
> tt=tt+12
> endwhile
> 'disable fwrite'
>
>
> On Wed, May 18, 2016 at 2:03 PM, Lekshmi Mudra <lekshmimdr at gmail.com>
> 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
>>
>>
>
>
> --
> 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
>
> ****************************************************
>



More information about the gradsusr mailing list