[gradsusr] Problem Extracting data in netcdf format

Jennifer Adams jma at cola.iges.org
Wed Feb 9 12:31:34 EST 2011


You keep overwriting the output because your output file always has  
the same name. Move your 'set sdfwrite' command inside the while loop  
and add 't' to the filename, something like this:
'set sdfwrite rain_'t'.nc'
--Jennifer


On Jan 15, 2011, at 9:53 AM, Zablone Owiti 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

--
Jennifer M. Adams
IGES/COLA
4041 Powder Mill Road, Suite 302
Calverton, MD 20705
jma at cola.iges.org



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20110209/73e6df62/attachment-0003.html 


More information about the gradsusr mailing list