T.,<div>Whenever you have multiple files open simultaneously, you need to use a .n appended to the variable name to reference the file. �It seems in your case, the variable in the second file is also TK, but you would need to refer to it as TK.2. �Also, you have open statements in your while loop, but no close statements. �Thus you will continue to open new files that will need successively higher reference numbers (.3, .4, etc). �Either use an index variable outside of quotes as the reference OR close each file at the end of each iteration of the loop. �Finally, remember to enclose statements in quotes if you would enter them at the Grads command prompt (like setting lat and lon values).</div>
<div><br></div><div>Jeff<br><div><br><div class="gmail_quote">On Sun, Feb 3, 2013 at 12:14 PM, T. haghroosta <span dir="ltr"><<a href="mailto:haghroosta@hotmail.com" target="_blank">haghroosta@hotmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div dir="ltr">
Dear Jeff Duda,<br>�<br>I did your suggestion as follows. As an extra explanation, I would like to calculate RMSE for a special parameter like TK during four days in a special Lon and Lat. I also have two files, observed and simulated. So, I wrote this script, but it didn't work. Could you please help me? Another question how can I show the last output (RMSE)?<br>
�<br>�t=1<br>pow=0<br>'reinit'<br>while(t<=4)<br>'sdfopen <a href="http://observed.nc" target="_blank">observed.nc</a>'<br>lon= 100<br>lat= 21<br>TK1=TK<br>'close 1'<br>'open simulated.ctl'<br>
TK2=TK<br>'pow1=pow(TK1(t)-TK2(t))<br>'pow = pow + pow1<br>t=t+1<br>endwhile<br>'RMSE= sqrt(pow/t)'<br><br>�Regards,<br>�<br>T.<br>�<br>�<br><div><br>> <br>> Today's Topics:<br>> <br>> 1. How to define this formula? (T. haghroosta)<br>
> 2. Re: How to define this formula? (Jeff Duda)<br>> 3. Re: lon lat to km (wendi harjupa)<br>> <br>> <br>> --------------------------------------------------------------!
--------<br>> <br>> Message: 1<br>> Date: Sun, 3 Feb 2013 05:24:48 +0000<br>> From: "T. haghroosta" <<a href="mailto:haghroosta@hotmail.com" target="_blank">haghroosta@hotmail.com</a>><br>> Subject: [gradsusr] How to define this formula?<br>
> To: <<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>><br>> Message-ID: <DUB121-W214D8BDEBA3D102D60AD37DD020@phx.gbl><br>> Content-Type: text/plain; charset="windows-1256"<div class="im">
<br>> <br>> <br>> <br>> <br>> <br>> Dear All, Could you please tell me how can I define this equation which I have attached to the email. I got confused completely, I did somethings that don't work. <br>
> <br>> Regards, T.<br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>> <br>
</div>> -------------- next part --------------<br>> An HTML attachment was scrubbed...<br>> URL: <a href="http://gradsusr.org/pipermail/gradsusr/attachments/20130203/f3a4e" target="_blank">http://gradsusr.org/pipermail/gradsusr/attachments/20130203/f3a4e</a>!
59a/attachment-0001.html <br>> -------------- next part -----------
---<br>> A non-text attachment was scrubbed...<br>> Name: D.jpg<br>> Type: image/jpeg<br>> Size: 6713 bytes<br>> Desc: not available<br>> Url : <a href="http://gradsusr.org/pipermail/gradsusr/attachments/20130203/f3a4e59a/attachment-0001.jpg" target="_blank">http://gradsusr.org/pipermail/gradsusr/attachments/20130203/f3a4e59a/attachment-0001.jpg</a> <br>
> <br>> ------------------------------<br>> <br>> Message: 2<br>> Date: Sun, 3 Feb 2013 01:53:22 -0600<br>> From: Jeff Duda <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>><br>
> Subject: Re: [gradsusr] How to define this formula?<br>> To: GrADS Users Forum <<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>><br>> Message-ID:<br>> <<a href="mailto:CAAig09DhORYVv_MLG58R5SEAv9pypU41igt_7XwYt97v9Ljocw@mail.gmail.com" target="_blank">CAAig09DhORYVv_MLG58R5SEAv9pypU41igt_7XwYt97v9Ljocw@mail.gmail.com</a>><br>
> Content-Type: text/plain; charset="iso-8859-1"<div class="im"><br>> <br>> That looks like standard deviation or RMSE. Either way, assume your array<br>> is VAR. Then it's<br>> <br>> C = sqrt(amean(asum(pow(VAR -<br>
> amean(VAR,x=x1,x=x2,y=y1,y=y2)),2),x=x1,x=x2,y=y1,y=y2))<br>> <br>> OR<br>> <br></div>> C = sqrt(asum(V!
AR - amean(VAR,x=x1,x=x2,y=y1,y=y2))/N), where N is the<div class="im"><br>> number of grid points over which you're summing.<br>> <br>> You'll have to insert values for x1, x2, y1, and y2 yourself. You can use<br>
> lat and lon instead of y and x, though.<br>> <br>> If that fails, try breaking it into parts:<br>> 'average = amean(VAR,x=x1,x=x2,y=y1,y=y2)'<br>> 'diffsquaredsum = asum(pow(VAR-average,2),x=x1,x=x2,y=y1,y=y2)'<br>
> 'SD (or) RMSE = sqrt(diffsquaredsum/N)'<br>> <br>> Jeff Duda<br>> <br>> On Sat, Feb 2, 2013 at 11:24 PM, T. haghroosta <<a href="mailto:haghroosta@hotmail.com" target="_blank">haghroosta@hotmail.com</a>>wrote:<br>
> <br>> > Dear All,<br>> ><br>> > Could you please tell me how can I define this equation which I have<br>> > attached to the email. I got confused completely, I did somethings that<br>> > don't work.<br>
> ><br>> > Regards,<br>> ><br>> > T.<br>> ><br></div>> > **** ** ** ** ** ** ** ** ** ** ** ** ** ** ** *!
*************************<br>> > ** **** ********<br>> ><b>> > _______________________________________________<div class="im"><br>> > gradsusr mailing list<br>> > <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> > <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>> ><br>> ><br>> <br>> <br>> -- <br>> Jeff Duda<br>> Graduate research assistant<br>
> University of Oklahoma School of Meteorology<br>> Center for Analysis and Prediction of Storms<br></div>> -------------- next part --------------<br>> An HTML attachment was scrubbed...<br>> URL: <a href="http://gradsusr.org/pipermail/gradsusr/attachments/20130203/0cd5f463/attachment-0001.html" target="_blank">http://gradsusr.org/pipermail/gradsusr/attachments/20130203/0cd5f463/attachment-0001.html</a> <br>
> <br>> ------------------------------<br>> <br>> Message: 3<br>> Date: Sun, 3 Feb 2013 21:55:53 +0900<br>> From: wendi harjupa <<a href="mailto:wendiharjupa@gmail.com" target="_blank">wendiharjupa@gmail.com</a>><br>
> Subject: Re: [gradsusr] lon lat to km<br>> To: GrADS Users Forum <<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a>><br>> Message-ID:<br>> <<a href="mailto:CA%2Bu6P9METKDdi6QQkH-FZT7mMzcFSAR17MeuvY-hiOkwYQn6Ow@mail.gmail.com" target="_blank">CA+u6P9METKDdi6QQkH-FZT7mMzcFSAR17MeuvY-hiOkwYQn6Ow@mail.gmail.com</a>>!
<br>> Content-Type: text/plain; charset="iso-8859-1"<br>> <br>> Dear Mr. Jeff<br>> <br>> Thank you very much for your guidance as far..<br>> But, I am very sorry for asking you many times..<br>
> since it is very difficult for me..<br>> <br>> I tried to change some parts of script, but still this did not run..<br>> I got error message as below :<br>> <br>> Error from CDIFF: Specified dimension non varying<br>
> Operation Error: Error from cdiff function<br>> Error ocurred at column 31<br>> DEFINE error: Invalid expression.<br>> *** glibc detected *** grads: corrupted double-linked list: 0x089e2918<br>> ***<br>
> Would you mind to explain more??<br>> <br>> Thank you very much<br>> <br>> Best regards,<br>> wendi<br>> <br>> On Sun, Feb 3, 2013 at 1:46 AM, Jeff Duda <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>> wrote:<br>
> <br>> > Use this code:<br>> ><br>> > 'reinit'<br>> > 'open try2.ctl'!
<br>> > 'set grads off'<br>> > 'set mproj latlon'<br>>
> 'set mpdset hires'<br>> > 'set gxout shaded'<br>> > 'set grid on'<br>> > 'set lon 100 101'<br>> > 'set lat -1 0'<br>> > 'define dx = *6.371e3**cos(-1*(3.14159/180))*cdiff(100,0)*(3.14159/180)'<br>
> > 'define dy = *6.371e3**cdiff(-1,0)*(3.14159/180))'<br>> > 'define xdist = ((lon-100)/0.004492369)*(dx/2)'<br>> > 'define ydist = ((lat-0)/0.004522556)*(dy/2)'<br>> > 'set z 5'<br>
> > 'set t 1'<br>> > 'd ref'<br>> ><br>> > The square brackets were just to show different groupings. When it comes<br>> > time to code it, you must use only parentheses.<br>
> ><br>> > The above should work.<br>> ><br>> > Jeff<br>> ><br>> > On Sat, Feb 2, 2013 at 1:41 AM, wendi harjupa <<a href="mailto:wendiharjupa@gmail.com" target="_blank">wendiharjupa@gmail.com</a>>wrote:<br>
> ><br>> >> Dear Mr. Jeff<br>> >><br>> >> Thank you very much for your explanation,<br>> >> but I am very sorry, !
I still do not get it,<br>> >><br>> >> I made new script<br>> >><br>> >> 'reinit'<br>> >> 'open try2.ctl'<br>> >> 'set grads off'<br>> >> 'set mproj latlon'<br>
> >> 'set mpdset hires'<br>> >> 'set gxout shaded'<br>> >> 'set grid on'<br>> >> 'set lon 100 101'<br>> >> 'set lat -1 0'<br>> >> 'define dx = *6.371e3**cos(-1*(3.14159/180))*cdiff(100,0)*(3.14159/180)'<br>
> >> 'define dy = *6.371e3**cdiff(-1,0)*(3.14159/180))'<br>> >> 'define xdist = ((lon-100)/0.004492369)*(dx/2]'<br>> >> 'define ydist = ((lat-0)/0.004522556)*dy/2]'<br>> >> 'set z 5'<br>
> >> 'set t 1'<br>> >> 'd ref'<br>> >><br>> >> I checked grads document and I found that 6.371e3 is radius of the earth<br>> >> (6371 to 6374 km)*.*<br>> >> *<br>
> >> *<br>> >> *I tried to change "*6.371e3" to!
"0e10" which is mean 0 to 10 km)<br>> >> But still the progr
am did not run normally.<br>> >><br>> >> I changed the value of lon and lat in script with 100 and -1.<br>> >> but still I got error.<br>> >><br>> >> Please help me to solve it.<br>
> >><br>> >> Thank you very much<br>> >> Best regards,<br>> >> wendi<br>> >><br>> >> On Sat, Feb 2, 2013 at 2:21 AM, Jeff Duda <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>> wrote:<br>
> >><br>> >>> Wendi,<br>> >>> You need to run those two define commands at the top of my previous<br>> >>> email before attempting to define the xdist and ydist fields. Also, since<br>
> >>> I can see your control file information, I can see that dlon is 0.004492369<br>> >>> and dlat is 0.004522556. So substitute those two values into your<br>> >>> expressions for xdist and ydist also.<br>
> >>><br>> >>> Jeff<br>> >>><u></u>> >>><br>> >>> On Fri, Feb 1, 2013 at 4:36 AM, wendi harjupa <<a href="mailto:wendiharjupa@gmail.com" target="_blank">wendiharjupa@gmail.com</a>>wrote:<br>
> >>><br>> >>>> Dear Mr. Jeff<br>> >>>><br>> >>>> I have tried to use the scipt which you suggested,<br>> >>>> But, still I could not do it. Would you help me more...<br>
> >>>><br>> >>>> here I send my gs file :<br>> >>>><br>> >>>> 'reinit'<br>> >>>> 'open try2.ctl'<br>> >>>> 'set grads off'<br>
> >>>> 'set mproj latlon'<br>> >>>> 'set mpdset hires'<br>> >>>> 'set gxout shaded'<br>> >>>> 'set grid on'<br>> >>>> 'set lon 100 101'<br>
> >>>> 'set lat 0 1'<br>> >>>> 'define xdist = [(lon 99.7)/dlon]*[dx/2]'<br>> >>>> 'define ydist = [(lat -1.02)/dlat]*[dy/2]'<br>> >>!
>> 'set z 5'<br>> >>>> 'set t 1'<br>> >>
>> 'd ref'<br>> >>>><br>> >>>> Below is my ctl file :<br>> >>>><br>> >>>> DSET 1013.dat<br>> >>>> TITLE RADAR<br>> >>>> OPTIONS TEMPLATE LITTLE_ENDIAN<br>
> >>>> UNDEF -1000<br>> >>>> XDEF 321 LINEAR 99.688120996 0.004492369<br>> >>>> YDEF 321 LINEAR -1.083708891 0.004522556<br>> >>>> ZDEF 39 LINEAR 1.0 0.5<br>
> >>>> TDEF 15 LINEAR 13:00Z10apr2004 4mn<br>> >>>> VARS 2<br>> >>>> ref 39 99 Reflectivity(dBZ)<br>> >>>> vel 39 99 Doppler Velocity(m/s)<br>> >>>> ENDVARS<br>
> >>>><br>> >>>><br>> >>>> Would you check my gs file, is there something that I have to revise??<br>> >>>><br>> >>>> Thank you very much.<br>> >>>><br>
> &g!
t;>>> Best regards,<br>> >>>> wendi<br>> >>>><br>> >>>><br>> >>>><br>> >>>> On Fri, Feb 1, 2013 at 10:34 AM, Jeff Duda <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>>wrote:<br>
> >>>><br>> >>>>> These commands will help.<br>> >>>>><br>> >>>>> 'define dx = 6.371e3*cos(lat*(3.14159/180))*cdiff(lon,x)*(3.14159/180)'<br>> >>>>> 'define dy = 6.371e3*cdiff(lat,y)*(3.14159/180))'<br>
> >>>>><br>> >>>>> They define grid increments in terms of spatial distance rather than<br>> >>>>> geographic distance. If you're trying to change the axes and tick marks,<br>
> >>>>> you'll have to define an origin and define your x and y distances based on<br>> >>>>> that. For instance, if you set your lower left domain corner (latitude 0<br>> >>>&gt!
;> and longitude 100), then you can define your coordinate distance
s using<br>> >>>>><br>> >>>>> 'define xdist = [(lon-100)/dlon]*[dx/2]'<br>> >>>>> 'define ydist = [(lat-0)/dlat]*[dy/2]'<br>> >>>>><br>
> >>>>> I think this should work, but I haven't tested it myself, so I don't<br>> >>>>> know. dlon and dlat are the step values from the XDEF and YDEF lines of<br>> >>>>> the control file, respectively.<br>
> >>>>><br>> >>>>> Jeff Duda<br>> >>>>><br>> >>>>> On Thu, Jan 31, 2013 at 7:02 AM, wendi harjupa <<a href="mailto:wendiharjupa@gmail.com" target="_blank">wendiharjupa@gmail.com</a><br>
> >>>>> > wrote:<br>> >>>>><br>> >>>>>> Dear Sir/Madam<br>> >>>>>><br>> >>>>>> I need help<br>> >>>>>> I have problem with grads command,<br>
> >>>>>> I am not well understand wi!
th command gr2XY,<br>> >>>>>><br>> >>>>>> Actually I want to convert the lon 100 to 101, and lat 0 to 1 to<br>> >>>>>> distance (km)<br>> >>>>>> let think that lon 100 is 0 km, and lat 0 is 0 km,<br>
> >>>>>><br>> >>>>>> what command I can use to convert lon and lat to km?<br>> >>>>>><br>> >>>>>> Thank you very much for your help<br>> >>>>>><br>
> >>>>>> best regards,<br>> >>>>>> --<br>> >>>>>> -------------<br>> >>>>>> Wendi Harjupa. ST<br>> >>>>>> Shimane University Graduate School of Engineering Sciences<br>
> >>>>>> Department of Electronic Control Systems<br>> >>>>>> Remote Sensing Laboratory<br>> >>>>>> s119447<br>> !
>>>>>> Cellphone : +81-080-4268-6676<br>> >&gt
;>>>> email : <a href="mailto:wendi@rslab.riko.shimane-u.ac.jp" target="_blank">wendi@rslab.riko.shimane-u.ac.jp</a><div class="im"><br>> >>>>>><br>> >>>>>> _______________________________________________<br>
> >>>>>> gradsusr mailing list<br>> >>>>>> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>> >>>>>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
> >>>>>><br>> >>>>>><br>> >>>>><br>> >>>>><br>> >>>>> --<br>> >>>>> Jeff Duda<br>> >>>>> Graduate research assistant<br>
> >>>>> University of Oklahoma School of Meteorology<br>> >>>>> Center for Analysis and Prediction of Storms<br>> >>>>><br>> >>>>> _______________________________________________<br>
> >>>>> gradsusr mailing list<br>> >>>>> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br></div>> >>&gt!
;>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>> >>>>><br>> >>>>><br>> >>>><br>> >>>><br>
> >>>> --<br>> >>>> -------------<br>> >>>> Wendi Harjupa. ST<br>> >>>> Shimane University Graduate School of Engineering Sciences<br>> >>>> Department of Electronic Control Systems<br>
> >>>> Remote Sensing Laboratory<br>> >>>> s119447<br>> >>>> Cellphone : +81-080-4268-6676<br>> >>>> email : <a href="mailto:wendi@rslab.riko.shimane-u.ac.jp" target="_blank">wendi@rslab.riko.shimane-u.ac.jp</a><div class="im">
<br>> >>>><br>> >>>> _______________________________________________<br>> >>>> gradsusr mailing list<br>> >>>> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> >>>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>> >>>><br>> >>>><br>> >>><br>> >>><br>
</div>&!
gt; >>> --<br>> >>> Jeff Duda<br>> >>&gt
; Graduate research assistant<div class="im"><br>> >>> University of Oklahoma School of Meteorology<br>> >>> Center for Analysis and Prediction of Storms<br>> >>><br></div><div class="im">
> >>> _______________________________________________<br>> >>> gradsusr mailing list<br>> >>> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>> >>> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
> >>><br>> >>><br>> >><br>> >><br>> >> --<br></div>> >> -------------<br>> >> Wendi Harjupa. ST<br>> >> Shimane University Graduate School of Engineering Sciences<br>
> >> Department of Electronic Control Systems<br>> >> Remote Sensing Laboratory<br>> >> s119447<br>> >> Cellphone : +81-080-4268-6676<br>> >> email : <a href="mailto:wendi@rslab.riko.shimane-u.ac.jp" target="_blank">wendi@rslab.riko.shimane-u.ac.jp</a><br>
> >><br>> >> _______________________________________________<br>> >> gradsusr mailing!
list<div class="im"><br>> >> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>> >> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
> >><br>> >><br>> ><br>> ><br>> > --<br>> > Jeff Duda<br>> > Graduate research assistant<br>> > University of Oklahoma School of Meteorology<br>> > Center for Analysis and Prediction of Storms<br>
> ><br>> > _______________________________________________<br>> > gradsusr mailing list<br>> > <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>> > <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
> ><br>> ><br>> <br>> <br>> -- <br></div>> -------------<br>> Wendi Harjupa. ST<br>> Shimane University Graduate School of Engineering Sciences<br>> Department of Electronic Control Systems<br>
> Remote Sensing Laboratory<br>> s119447<br>> Cellphone : +81-080-4268-6676<br>> email : <a href="mailto:wendi@rslab.riko.shimane-u.ac.jp" target="_blank">wendi@rslab.riko.shimane-u.ac.jp</a><br>> -------------- next part --------------<br>
> An HTML !
attachment was scrubbed...<br>> URL: <a href="http://gradsusr.org/pipermail/" target="_blank">http://gradsusr.org/pipermail/</a>
gradsusr/attachments/20130203/3be6f25a/attachment.html <br>> <br>> ------------------------------<div class="im"><br>> <br>> _______________________________________________<br>> gradsusr mailing list<br>> <a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
> <a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>> <br>> <br></div>> End of gradsusr Digest, Vol 36, Issue 8<br>> ***************************************<br>
</b></div> </div></div>
<br>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Jeff Duda<br>Graduate research assistant<br>University of Oklahoma School of Meteorology<br>Center for Analysis and Prediction of Storms<br>
</div></div>