[gradsusr] Problem Extracting data in netcdf format
Felix Mutua
felix.mutua at gmail.com
Wed Feb 9 08:00:56 EST 2011
Dear Zablone,
I think editing your script like this may work..i.e using fwrite function
*********************************************************************
'reinit'
'sdfopen gcpcr.nc'
'set x 0.5 360.5'
'set y 1 180'
'set gxout fwrite'
'set fwrite rain.dat'
t=151
while(t<=670)
'set t 't''
'd jas = ave(r,t='t',t='t'+2)'
t=t+12
endwhile
'disable fwrite'
* Proceed and prepare a .ctl file for the extract in year*
*************************For Example**********************
DSET rain.dat
TITLE Monthly Avg Rain
*
OPTIONS little_endian
FILEHEADER 0
UNDEF 9.99E+33
XDEF 145 LINEAR 0 2.5
YDEF 72 LINEAR -88.75 2.5
ZDEF 17 LEVELS
1000 925 850 700 600 500 400 300 250 200 150 100
70 50 30 20 10
TDEF 30 LINEAR 00:00Z01OCT1979 1YR
*
VARS 5
rain 17 99 Rainfall
endvars
************************************************************
**************************************************************
I'm also interested to know how the sdfwrite function because it seems not
to work in the same way....
Regards
On Sat, Jan 15, 2011 at 11:53 PM, Zablone Owiti <zablonowiti at yahoo.com>wrote:
> Hi Rashed,
> How can I adjust it to stop overwriting the output? See below the .gs file.
>
> Thanks
>
> 'reinit'
> 'sdfopen gcpcr.nc'
> 'set x 0.5 360.5'
> 'set y 1 180'
> t = 151
> 'set sdfwrite rain.nc'
> *'set gxout fwrite'
> while (t<670)
> 'set t 't
> 'define jul=r'
> 'set t 't+1
> 'define aug=r'
> 'set t 't+2
> 'define sep=r'
> 'define jas=(jul+aug+sep)/3'
> 'sdfwrite jas'
> t = t+12
> endwhile
> 'clear sdfwrite'
> ;
>
>
>
>
> *===================================================*
> *ZABLONE OWITI
> GRADUATE STUDENT
> Nanjing University of Information, Science and Technology
> College of International Education
> Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China
> *Tel: +86-25-58731402
> Fax: +86-25-58731456
> *Mob. 15077895632*
> *Website: www.nuist.edu.cn
> **====================================================
> "The real art of conversation is not only to say the right thing at the
> right time, but also to leave unsaid the wrong thing at the tempting
> moment."
>
> *
>
> *From:* Rashed Mahmood <rashidcomsis at gmail.com>
> *To:* Zablone Owiti <zablonowiti at yahoo.com>; GrADS Users Forum <
> gradsusr at gradsusr.org>
> *Cc:*
> *Sent:* Saturday, 15 January 2011 8:34 PM
> *Subject:* Re: [gradsusr] Problem Extracting data in netcdf format
>
>
> I guess your loop is overwriting the output file and the output variable as
> after every loop as the name is same after each iteration...
>
>
>
> Rashed
>
> Institute of Atmospheric Physics
> (CAS) Beijing.
>
> On Thu, Jan 13, 2011 at 6:13 PM, Zablone Owiti <zablonowiti at yahoo.com>wrote:
>
> Dear users,
> I am attempting to extract seasonal(JAS) data from a monthly netcdf data
> file using the attached script.
> When I run the script, it only write the first timestep data(i.e it fails
> to loop).
> What could be error in the script?
>
> Thanks
>
> *===================================================*
> *ZABLONE OWITI
> GRADUATE STUDENT
> Nanjing University of Information, Science and Technology
> College of International Education
> Add: 219 Ning Liu Rd, Nanjing, Jiangsu, 21004, P.R. China
> *Tel: +86-25-58731402
> Fax: +86-25-58731456
> *Mob. 15077895632*
> *Website: www.nuist.edu.cn
> **====================================================
> "The real art of conversation is not only to say the right thing at the
> right time, but also to leave unsaid the wrong thing at the tempting
> moment."
>
> *
>
>
> _______________________________________________
> 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
>
>
--
_________________________________________________________
Felix Mutua
School of Engineering, The University of Tokyo
River Engineering and Environment Laboratory
7-3-1 Hongo Bunkyo-ku, Tokyo 113-8656, Japan
Phone +81-80-3553-0339,
E-mail: Felix.mutua at gmail.com, f-mutua at hydra.t.u-tokyo.ac.jp
Skype: Felix.mutua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110209/83acfc32/attachment-0003.html
More information about the gradsusr
mailing list