[gradsusr] Average in two different time and locations

T. haghroosta haghroosta at hotmail.com
Thu Feb 7 21:33:37 EST 2013


Dear Ricardo, Thank you very much. Your script works and I am happy. Best regards, T.
 > From: gradsusr-request at gradsusr.org
> Subject: gradsusr Digest, Vol 36, Issue 29
> To: gradsusr at gradsusr.org
> Date: Wed, 6 Feb 2013 02:36:24 -0500
> 
> 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: binary to netCDF conversion problems (Jeff Duda)
>    2. Re: Average in two different time and locations (Ricardo Hallak)
>    3. Re: linear trend in grads (Roberto Mera)
>    4. Vertical gradient of the saturation mixing ratio
>       (Morwakoma Matabane)
>    5. Vertical gradient of the saturation mixing ratio
>       (Morwakoma Matabane)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Tue, 5 Feb 2013 15:04:58 -0600
> From: Jeff Duda <jeffduda319 at gmail.com>
> Subject: Re: [gradsusr] binary to netCDF conversion problems
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID:
> 	<CAAig09D1yvoR-vOQ+qwkFfK4vSZwOLXM3NxPGWJvJ=DSCktuWQ at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> >From your 'q dims' result:
> X is varying   Lon = 0 to 360   X = 360.5 to 1080.5
> 
> I'd be willing to bet my grad student stipend Grads is using the points x =
> 360 through x = 1081 (inclusive) to write out the data.  You should set
> your dimension to something else to avoid having half-index values or
> decrease your x-dimension environment boundaries by 1.0 points each ('set x
> 361 1080').  Either that, or adjust the XDEF entry in your control file to
> match what you're setting in your dimension environment.
> 
> Jeff Duda
> 
> On Tue, Feb 5, 2013 at 12:07 PM, Rosalyn F Maccracken <rmaccrac at gmu.edu>wrote:
> 
> > Dear Users,
> >
> > I am trying to convert a binary file to a netCDF4
> > file using sdfwrite.  I have a control file
> > which looks like:
> >
> > DSET tsfc_3hr_%y4%m2.dat
> > OPTIONS TEMPLATE
> > UNDEF -1000.
> > XDEF 720 LINEAR  -179.75 0.50
> > YDEF 360 LINEAR   -89.75 0.50
> > ZDEF    1 LEVELS 1000.
> > TDEF 8768 LINEAR 00z01Jan2007 3hr
> > VARS 1
> > tsfc  0   99
> > ENDVARS
> >
> > When I do 'q dims', I get:
> > Default file number is: 1
> > X is varying   Lon = 0 to 360   X = 360.5 to 1080.5
> > Y is varying   Lat = -89.75 to 89.75   Y = 1 to 360
> > Z is fixed     Lev = 1000  Z = 1
> > T is fixed     Time = 00Z01JAN2007  T = 1
> > E is fixed     Ens = 1  E = 1
> >
> > So, lon should have 720 points, lat should
> > have 180 points, and for a 30 day month, there
> > should be 248 time steps.
> >
> > However, when I use the sdfwrite command:
> >
> > open tsfc_3hr.ctl
> > set time 00Z01Jan2007 21Z30Jan2007
> > define tsfc = tsfc
> > set sdfwrite -flt -nc4 <tsfc_file>.nc4
> > sdfwrite tsfc
> >
> > I get metadata that has the wrong lon
> > dimension:
> > netcdf tsfc_3hr_Aug1995 {
> > dimensions:
> >         lon = 722 ;
> >         lat = 360 ;
> >         time = 248 ;
> > (etc)
> >
> > So, my questions are, why is the lon dimension
> > wrong and how do I fix this?
> >
> > Thanks,
> > Roz
> >
> > ********************************
> > Rosalyn F. MacCracken, Ph.D.
> > Postdoctoral Research Fellow
> > Department of Geography and Geoinformation Science
> > George Mason University
> > Fairfax, VA
> > (301) 335-1222
> > rmaccrac at gmu.edu
> >
> > _______________________________________________
> > gradsusr mailing list
> > gradsusr at gradsusr.org
> > http://gradsusr.org/mailman/listinfo/gradsusr
> >
> 
> 
> 
> -- 
> Jeff Duda
> Graduate research assistant
> University of Oklahoma School of Meteorology
> Center for Analysis and Prediction of Storms
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130205/08b6f718/attachment-0001.html 
> 
> ------------------------------
> 
> Message: 2
> Date: Tue, 5 Feb 2013 18:19:52 -0300
> From: "Ricardo Hallak" <hallak at model.iag.usp.br>
> Subject: Re: [gradsusr] Average in two different time and locations
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <20130205204710.M95724 at model.iag.usp.br>
> Content-Type: text/plain; charset="iso-8859-1"
> 
> Dear Theresa,
> 
> try this piece of script below:
> 
> ?'reinit'
> ?'open E:\test.ctl'
> ?'set t 5'
> ?'set lat 7'
> ?'set lon 107'
> * 'define r1= sst'? !NOT NECESSARY, since you have already set a single point.
> ?'d sst'
> r1=subwrd(result,4)
> say r1
> 'close 1'
> ?'sdfopen sst.nc' 
> ?'set t 5'
> ?'set lat 7'
> ?'set lon 107'
> ?*'define r2= sst' !NOT NECESSARY 
> 'd sst'
> ?r2=subwrd(result,4)
> say r2
> 
> 'define aver= ('r1'+'r2')/2'
> ?
> 'd aver'
> ?Ar=subwrd(result,4)
> ?say Ar
> ? 
> NOTE that, now, r1 and r2 are "script variables" (not "grads prompt variables"), since they were "captured" with "subwrd", and not with "define". So, r1 and r2 have to appear between quotes in the Ar definition. Note also that you can not use this kind of construction in the grads prompt terminal:
> 
> 'd sst'
> ?r2=subwrd(result,4)
> 
> So, script variables CAN NOT be directly displayed in the grads graphic window: they exist only in the script memory.
> 
> On the other hand, DEFINED variables exist in the "GrADS prompt memory" and in the "script memory". These defined variables can be directly displayed in the grads graphic window. Of course, to make computations with defined variables, you don't need to put quotes in the variables. Is it clear enough?
> ?
> Please, let me know if this doesn't work as you expect.
> 
> Regards,
> Ricardo
> 
> On Tue, 5 Feb 2013 18:10:01 +0000, T. haghroosta wrote
> > Dear Ricardo,
> > ?
> > The script that you helped me to write, was run correctly. Now I would like to calculate the average of one parameter in two different files. I wrote this script, but it doesn't show me any outputs. Could you please tell me what is the problem?
> > ?
> > 'reinit'
> > 'open E:\test.ctl'
> > 'set t 5'
> > 'set lat 7'
> > 'set lon 107'
> > 'define r1= sst'
> > 'close 1'
> > 'sdfopen sst.nc'
> > 'set t 5'
> > 'set lat 7'
> > 'set lon 107'
> > 'define r2= sst'
> > 'define aver= (r1+r2)/2'
> > 'd aver'
> > Ar=subwrd(result,4)
> > say Ar
> > 
> > Regards,
> > ?
> > T.?
> > 
> > > 
> > > 
> > > Today's Topics:
> > > 
> > > 1. Re: Average in two different time and locations (T. haghroosta)
> > > 
> > > 
> > > ----------------------------------------------------------------------
> > >
> 
>  
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130205/07eacbaa/attachment-0001.html 
> 
> ------------------------------
> 
> Message: 3
> Date: Tue, 05 Feb 2013 13:56:15 -0800
> From: Roberto Mera <rjmera at coas.oregonstate.edu>
> Subject: Re: [gradsusr] linear trend in grads
> To: GrADS Users Forum <gradsusr at gradsusr.org>
> Message-ID: <51117FFF.4070606 at coas.oregonstate.edu>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Michael,
> 
> I'm also interested in how to find out the significance. Any help would 
> be great?
> 
> BTW, the scripts worked perfectly.
> 
> Robert
> 
> On 8/3/2012 11:06 AM, Tereza Cavazos wrote:
> > Hi Michael,
> >
> > And how do you know if the trend is suignificant?
> > Do you have a program for that?
> >
> > Thanks,
> > Tereza
> >
> > El 03/08/2012 09:28 a.m., J-P Michael escribi?:
> >>     Robert,
> >>
> >> Here is my solution. Perhaps someone else has a more eloquent script for
> >> this.
> >>
> >> function get_trend (args)
> >>
> >> varname=subwrd(args,1)
> >> xlimit=subwrd(args,2)
> >> ylimit=subwrd(args,3)
> >> zlimit=subwrd(args,4)
> >> tlimit=subwrd(args,5)
> >> if (varname = '')
> >>      say ''
> >>      say 'you must first open the file to be detrended'
> >>      say ''
> >>      say 'then you must call this script like so: '
> >>      say 'scripts/get_trend.gs varname x y z t'
> >>      say 'example:'
> >>      say 'scripts/get_trend.gs temp 320 366 1 2400'
> >>      say ''
> >>      return
> >> endif
> >>
> >>
> >> 'set x 1 'xlimit
> >> 'set y 1 'ylimit
> >> 'set loopdim z'
> >>
> >> 'set t 1 'tlimit
> >> 'set z 1 'zlimit
> >> 'set x 1'
> >> 'set y 1'
> >> 'define base = const ('varname', 1, -a)'
> >> 'define ttime = sum(base, t = 1, t+1)'
> >> 'set z 1 'zlimit
> >> 'set x 1 'xlimit
> >> 'set y 1 'ylimit
> >> 'set t 1'
> >> 'define trend = tregr(ttime, 'varname', t=1, t = 'tlimit')'
> >> 'set z 1 'zlimit
> >>
> >> _______________________________________________
> >> gradsusr mailing list
> >> gradsusr at gradsusr.org
> >> http://gradsusr.org/mailman/listinfo/gradsusr
> >
> 
> 
> 
> ------------------------------
> 
> Message: 4
> Date: Wed, 6 Feb 2013 09:29:22 +0200
> From: Morwakoma Matabane <Morwakoma.Matabane at weathersa.co.za>
> Subject: [gradsusr] Vertical gradient of the saturation mixing ratio
> To: "'gradsusr at gradsusr.org'" <gradsusr at gradsusr.org>
> Message-ID:
> 	<06B0A85218E0A34EBBFFF4435CA4BAA45B45C7CFBA at sawsptahub01.saws.local>
> Content-Type: text/plain; charset="us-ascii"
> 
> Good day,
> 
> I have managed to compute the saturation vapor pressure of two levels, say z-1 and z+1. And after computing the mixing ratios for the respective levels, I cannot seem to be able to calculate the dQs/dz (the vertical gradient of the mixing ratios). All I get whenever I attempt to compute the dQs/dz is an ERROR.
> ...
> 
> 'set z 3'
> 
> *At temperature t1=t(z+1)
> 
> 'define qs1=0.622*es1/lev'
> 
> *At temperature t2=t(z-1)
> 
> 'define qs2=0.622*
> 
> 'define dq=(qs1-qs2)/(lev(z+1)-le(z-1))'
> 
> 'd dq'
> 
> OUTPUTS AN ERROR
> 
> How can I avoid the erroneous situation? Your help is highly appreciated.
> 
> 
> Regards
> Morwakoma
> South African Weather Service (SAWS) Scientist
> 
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130206/a0b077e2/attachment-0001.html 
> 
> ------------------------------
> 
> Message: 5
> Date: Wed, 6 Feb 2013 09:36:17 +0200
> From: Morwakoma Matabane <Morwakoma.Matabane at weathersa.co.za>
> Subject: [gradsusr] Vertical gradient of the saturation mixing ratio
> To: "'gradsusr at gradsusr.org'" <gradsusr at gradsusr.org>
> Message-ID:
> 	<06B0A85218E0A34EBBFFF4435CA4BAA45B45C7CFBB at sawsptahub01.saws.local>
> Content-Type: text/plain; charset="us-ascii"
> 
> Good day,
> 
> I have managed to compute the saturation vapor pressure of two levels, say z-1 and z+1. And after computing the mixing ratios for the respective levels, I cannot seem to be able to calculate the dQs/dz (the vertical gradient of the mixing ratios). All I get whenever I attempt to compute the dQs/dz is an ERROR.
> ...
> 
> 'set z 3'
> 
> *At temperature t1=t(z+1)
> 
> 'define qs1=0.622*es1/lev'
> 
> *At temperature t2=t(z-1)
> 
> 'define qs2=0.622*es2/lev'
> 
> 'define dq=(qs1-qs2)/(lev(z+1)-le(z-1))'
> 
> 'd dq'
> 
> OUTPUTS AN ERROR
> 
> How can I avoid the erroneous situation? Your help is highly appreciated.
> 
> 
> Regards
> Morwakoma
> South African Weather Service (SAWS) Scientist
> 
> 
> Morwakoma M Matabane BSc Witwatersrand, H. Dipl. Comp. Sc Witwatersrand, BSc Hon Pretoria, MSc Reading,  Research Scientist
> South African Weather Service 442 Rigel Avenue South Erasmusrand Pretoria 0181
> Tel: +27(0)12 367 6234 Fax:+27(0)12 367 6189
> E-mail: morwakoma.matabane at weathersa.co.za Website:www.weathersa.co.za
> [cid:image001.png at 01CE044D.69CE1730]
> "Power our future with weather, climate and water"
> "Big whorls have little whorls that feed on their velocity, and little whorls have lesser whorls and so on to viscosity", Lewis F Richardson.
> 
> 
> 
> 
> 
> 
> 
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130206/963bc8e0/attachment.html 
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: image001.png
> Type: image/png
> Size: 4963 bytes
> Desc: image001.png
> Url : http://gradsusr.org/pipermail/gradsusr/attachments/20130206/963bc8e0/attachment.png 
> 
> ------------------------------
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
> 
> 
> End of gradsusr Digest, Vol 36, Issue 29
> ****************************************
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20130208/f5a850b2/attachment-0003.html 


More information about the gradsusr mailing list