[gradsusr] gradsusr Digest, Vol 59, Issue 46

Victor D asldikvin at yahoo.com
Mon Jan 26 05:00:09 EST 2015


Hi Everyone,I am trying to calculate average summer sst for 30 years.What could be wrong with this script. I will appreciate suggestions Please. 
Thanks
'reinit'
'sdfopen d:\HadSST2_1x1.nc'
'set grads off'
'set gxout shaded'
'define a=ave(sst,t=1577,t=1581)'
'define b=ave(sst,t=1589,t=1593)'
'define c=ave(sst,t=1601,t=1605)'
'define d=ave(sst,t=1613,t=1617)'
'define e=ave(sst,t=1625,t=1629)'
'define f=ave(sst,t=1637,t=1641)'
'define g=ave(sst,t=1649,t=1653)'
'define h=ave(sst,t=1661,t=1665)'
'define i=ave(sst,t=1673,t=1677)'
'define j=ave(sst,t=1685,t=1689)'
'define k=ave(sst,t=1697,t=1701)'
'define l=ave(sst,t=1709,t=1713)'
'define m=ave(sst,t=1721,t=1725)'
'define n=ave(sst,t=1733,t=1737)'
'define o=ave(sst,t=1745,t=1749)'
'define p=ave(sst,t=1757,t=1761)'
'define q=ave(sst,t=1769,t=1773)'
'define r=ave(sst,t=1781,t=1785)'
'define s=ave(sst,t=1793,t=1797)'
'define t=ave(sst,t=1805,t=1809)'
'define u=ave(sst,t=1817,t=1821)'
'define v=ave(sst,t=1829,t=1833)'
'define w=ave(sst,t=1841,t=1845)'
'define x=ave(sst,t=1853,t=1857)'
'define y=ave(sst,t=1865,t=1869)'
'define z=ave(sst,t=1877,t=1881)'
'define a1=ave(sst,t=1889,t=1893)'
'define a2=ave(sst,t=1901,t=1905)'
'define a3=ave(sst,t=1913,t=1917)'
'define a4=ave(sst,t=1925,t=1929)'
'define b1=(a+b+c+d+e+f+g+h+i+j)/10'
'define b2=(k+l+m+n+o+p+q+r+s+t)/10'
'define b3=(u+v+w+x+y+z+a1+a2+a3+a4)/10'
'd (b1+b2+b3)'
'cbar'
'enable print d:\sst-1.png'
'print'
'disable print'




     On Sunday, January 25, 2015 11:39 PM, "gradsusr-request at gradsusr.org" <gradsusr-request at gradsusr.org> wrote:
   

 Send gradsusr mailing list submissions to
    gradsusr at gradsusr.org

To subscribe or unsubscribe via the World Wide Web, visit
    http://gradsusr.org/mailman/listinfo/gradsusr
or, via email, send a message with subject or body 'help' to
    gradsusr-request at gradsusr.org

You can reach the person managing the list at
    gradsusr-owner at gradsusr.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gradsusr digest..."


Today's Topics:

  1. Re: Creating a Binary File in Grads (Kishore Ragi)
  2. Creating a grads file from station data (dolesibeni)


----------------------------------------------------------------------

Message: 1
Date: Sun, 25 Jan 2015 08:34:46 +0530
From: Kishore Ragi <kishoreragi at gmail.com>
Subject: Re: [gradsusr] Creating a Binary File in Grads
To: GrADS Users Forum <gradsusr at gradsusr.org>
Message-ID:
    <CAN4rXbSe-yTcnt4=PRp61CM8Eg7tDAsa75ACOCHJNjw5y+shsg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

If you follow my suggestions carefully, you can get whatt you wanted.

Yes, I understand that you have .dat file with ctl. But, by the previous
suggestions, you can convert those .dat and ctl files to netcdf. Then you
can merge them as a combined netcdf. Handling of netcdf files is much
simpler than any other climate data files, atleast for me.

You just copy paste those commands that I have posted in the previous
email, if you already installed CDO in your machine.

But, if your goal is only to write grads script, other grads users may help
you.

Good luck !

Regards,

Kishore



On Sun, Jan 25, 2015 at 2:59 AM, Valeria Benson-Lira <vbensonl at asu.edu>
wrote:

> Hi Kishore,
>
> Thank you for your suggestions. The problem is that I need to have the
> script working for grads.
> For instance, my precipitation control files open a .dat file, they are
> not a netcdf.
> In this case, I want to create a binary file (.dat) which has all the
> precipitation values recorded in the 4 different files.
> No calculations are needed.
>
> Any suggestions?
>
> Thanks,
> Valeria
>
>
>
> On Fri, Jan 23, 2015 at 11:11 PM, Kishore Ragi <kishoreragi at gmail.com>
> wrote:
>
>> After getting this, if you still want only binary files, please let me
>> know. there are couple of options to make nc file to .dat file, even with
>> grads.
>>
>> On Sat, Jan 24, 2015 at 11:37 AM, Kishore Ragi <kishoreragi at gmail.com>
>> wrote:
>>
>>>
>>>
>>> *Hi Valeria Benson-Lira,*
>>> If you don't have problem working with nc files, I will give you other
>>> option to achieve your task.
>>>
>>> First, you make your ctl file into netcdf files as below
>>>
>>> cdo -f nc import_binary ENCB1_precip_apr2008.ctl precip.april.nc
>>> cdo -f nc import_binary ENCB1_precip_may2008.ct precip.may.nc
>>> cdo -f nc import_binary ENCB1_precip_jun2008.ctl precip.june.nc
>>> cdo -f nc import_binary ENCB1_precip_july2008.ctl precip.july.nc
>>>
>>> now merge them all in a single file like below
>>>
>>> cdo mergetime precip.april.nc precip.may.nc precip.june.nc
>>> precip.july.nc precip.AMJJ.nc
>>>
>>> Though, I did not help with grads, hope this helps.
>>>
>>> Cheers,
>>>
>>> Kishore
>>>
>>> On Sat, Jan 24, 2015 at 11:11 AM, Valeria Benson-Lira <vbensonl at asu.edu>
>>> wrote:
>>>
>>>> Dear Grads users,
>>>>
>>>> Can someone please help me with my script? I am trying to write a
>>>> binary file that contains all the values recorded in four different control
>>>> files. My new binary file will have the hourly precipitation records from
>>>> April through July. So far, the script works for the first month but not
>>>> for the following months.
>>>>
>>>> This is the script:
>>>>
>>>>
>>>> 'reinit'
>>>>
>>>> 'open ENCB1_precip_apr2008.ctl'
>>>>
>>>> 'open ENCB1_precip_may2008.ct'
>>>>
>>>> 'open ENCB1_precip_jun2008.ctl'
>>>>
>>>> 'open ENCB1_precip_july2008.ctl'
>>>>
>>>>
>>>> 'set gxout fwrite'
>>>>
>>>> 'set fwrite ENCB1_AMJJ_precip.dat '
>>>>
>>>>
>>>> *****Write April data First.
>>>>
>>>> *****Recall that April has 720 hours (30 days)
>>>>
>>>> *index*_t = 1
>>>>
>>>> while(*index*_t<=720)
>>>>
>>>>  'set t '*index*_t
>>>>
>>>>  say *index*_t
>>>>
>>>>  'd precip.1 '
>>>>
>>>>  *index*_t = *index*_t + 1
>>>>
>>>> endwhile
>>>>
>>>>
>>>> *****Write May data Next.
>>>>
>>>> *****Recall that May has 744 hours (31 days)
>>>>
>>>> *index*_t = 1
>>>>
>>>> while(*index*_t<=744)
>>>>
>>>>  'set t '*index*_t
>>>>
>>>>  say *index*_t
>>>>
>>>>  'd precip.2 '
>>>>
>>>>  *index*_t = *index*_t + 1
>>>>
>>>> endwhile
>>>>
>>>>
>>>> *****Write June data Next.
>>>>
>>>> *****Recall that June has 720 hours (30 days)
>>>>
>>>> *index*_t = 1
>>>>
>>>> while(*index*_t<=720)
>>>>
>>>>  'set t '*index*_t
>>>>
>>>>  say *index*_t
>>>>
>>>>  'd precip.3 '
>>>>
>>>>  *index*_t = *index*_t + 1
>>>>
>>>> endwhile
>>>>
>>>>
>>>> *****Write July data Next.
>>>>
>>>> *****Recall that July has 744 hours (31 days)
>>>>
>>>> *index*_t = 1
>>>>
>>>> while(*index*_t<=744)
>>>>
>>>>  'set t '*index*_t
>>>>
>>>>  say *index*_t
>>>>
>>>>  'd precip.4 '
>>>>
>>>>  *index*_t = *index*_t + 1
>>>>
>>>> endwhile
>>>>
>>>>
>>>> *************************
>>>>
>>>> 'disable fwrite'
>>>>
>>>> *************************
>>>>
>>>> *****Always reinitialize when finished,
>>>>
>>>> *****to avoid mistakingly writing extraneous data
>>>>
>>>> 'reinit'
>>>>
>>>>
>>>> Do you have a suggestion of how I can fix it?
>>>>
>>>> Thanks,
>>>>
>>>> *Valeria Benson-Lira*
>>>> *Graduate Teaching Assistant, Geography M.A.*
>>>> *e-mail: vbensonl at asu.edu <vbensonl at asu.edu>*
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>
>>
>
> _______________________________________________
> 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/20150125/0e31fb31/attachment-0001.html 

------------------------------

Message: 2
Date: Sun, 25 Jan 2015 16:01:12 +0200
From: dolesibeni <dolesibeni at gmail.com>
Subject: [gradsusr] Creating a grads file from station data
To: kishoreragi at gmail.com, gradsusr at gradsusr.org
Message-ID: <ptn3t71x5fh2e1ol7n8b9095.1422193122265 at email.android.com>
Content-Type: text/plain; charset="utf-8"

Dear Sir
Sorry for writing you pesronally instead of using the forum. I have on several occassion tried to ask through the forum but i dont get response.
My question is i have station data which i would like to read using grads. So from search i noted that i need to convert my station dsts to gridded format either using fortran or c. I tried several times but i am unable to come up with a .dat or .bin file which can be read by grads using my descriptor file.ctl.
My Datas is in this format:?
Stn name ? year month day var1 var2 var3 var4
A 2001 1 1 234 210 329 543

My descriptor file looks like this
Dset rainfall.dat
Dtype station
Stnmap rainfall.map
Undef -999
Title stationdata
Tdef 4 linear 1jan2000 1dy
Vars 4
Janprc 0 99 janary daily rainfall
Febprc 0 99 february daily rainfall
........
Up to ApRil
Endvars

Can you please help me to convert my station dats to grads format so that i can read it in grads.

Regards,
Charles Vanya




Sent from Samsung tablet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150125/1fd13970/attachment.html 

------------------------------

_______________________________________________
gradsusr mailing list
gradsusr at gradsusr.org
http://gradsusr.org/mailman/listinfo/gradsusr


End of gradsusr Digest, Vol 59, Issue 46
****************************************


   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20150126/33adc65c/attachment-0001.html 


More information about the gradsusr mailing list