[gradsusr] (no subject)

Gargi Akhoury gargiakhoury at bitmesra.ac.in
Tue Apr 5 01:15:41 EDT 2016


Hello,
     I am trying to plot a correlation between two netcdf files. The
program is below:

sdfopen precip.mon.mean.nc

sdfopen t1000.nc

set t 1

define pr=re(precip,144,linear,0,2.5,72,linear,-88.75,2.5,ba)

avr=tloop(ave((pr-ave(pr,t=1,t=20))*(pr-ave(pr,t=1,t=20)),t=1,t=20))

set dfile 2

define pt=re(temp.2(z=1)-273.15,144,linear,0,2.5,72,linear,-88.75,2.5,ba)

bvr=tloop(ave((pt-ave(pt,t=1,t=20))*( pt -ave(pt,t=1,t=20)),t=1,t=20))

define corr=
tloop(ave((pr-ave(pr,t=1,t=20))*(pt-ave(pt,t=1,t=20)),t=1,t=20))/sqrt(avr*bvr)

d corr


the error msg is:

ga-> d corr

Cannot contour grid - all undefined values


When I tried to display the "corr" variable, the error message comes.

As the two files are not same so I tried to regrid

the files are as below:-

precip.mon.mean.nc    : 144*72

t1000.nc                     : 144*73


Kindly, help me regarding this


Thanks & Regards

On Tue, Mar 29, 2016 at 7:46 AM, Gargi Akhoury <gargiakhoury at bitmesra.ac.in>
wrote:

> THANKU STEPHEN......!!!
>
> On Mon, Mar 28, 2016 at 10:44 PM, Stephen McMillan <
> smcmillan at planalytics.com> wrote:
>
>> Thanks, Gargi, that helps.  And, yes, it's possible to get all 365 daily
>> data.  Instead of 12 timesteps as you do now, you will loop through 365
>> timesteps.
>>
>> Since you are wanting results in text files for viewing in Excel, you may
>> want to consider using 'set gxout print' along with 'set prnopts...'
>> instead of 'set gxout fwrite'.  See appropriate entries in the GrADS
>> Documentation Index.
>>
>> Steve Mc
>>
>> On Mon, Mar 28, 2016 at 12:01 PM, Gargi Akhoury <
>> gargiakhoury at bitmesra.ac.in> wrote:
>>
>>> Hello Stephen,
>>>          Thanku for ur suggestions.....now m making it clear. Actually,
>>> I have daily precipitation data of 1951 (365 days) in binary form. I have
>>> to extract data on monthly basis and save it in excel sheet. Converting
>>> daily data into monthly data so I'll get only 12 values. The above program
>>> I have seen in Grads users forum and tried to apply it in my case. Hope
>>> this will make u clear.
>>>         One more query, is it possible to get all the 365 data (means
>>> daily data)??
>>>
>>> Thanks & Regards
>>>
>>> On Mon, Mar 28, 2016 at 8:30 PM, Stephen McMillan <
>>> smcmillan at planalytics.com> wrote:
>>>
>>>> Gargi,
>>>>
>>>> It is unclear what you are trying to accomplish, or the results that
>>>> you expect to get.  The way you have your script set up, you are "fwriting"
>>>> the summed precipitation 12 times to a file called "outputfile" but what is
>>>> the purpose of the single second write (monrf.csv,val)?  As written, the
>>>> latter would produce one value equal to the number of written elements.  Is
>>>> that what you wanted?  Also, does your fw output file not contain what you
>>>> expect?
>>>>
>>>> If you are getting an error message or just getting an unexpected
>>>> output, it would help if you include that in your reply, other than just
>>>> "not getting results."
>>>>
>>>> Stephen Mc
>>>>
>>>> On Mon, Mar 28, 2016 at 9:43 AM, Gargi Akhoury <
>>>> gargiakhoury at bitmesra.ac.in> wrote:
>>>>
>>>>> Hello,
>>>>>     I have corrected like this but not getting results..
>>>>>
>>>>> 'reinit'
>>>>>  mday = '31 28 31 30 31 30 31 31 30 31 30 31'
>>>>>  month = 'jan feb mar apr may jun jul aug sep oct nov dec'
>>>>>
>>>>> 'open rfc.ctl'
>>>>> 'set gxout fwrite'
>>>>> 'set fwrite outputfile'
>>>>>  yr = 1951
>>>>>
>>>>> imon=1
>>>>>   while(imon <= 12)
>>>>>    md = subwrd(mday,imon)
>>>>>    mc = subwrd(month,imon)
>>>>>   time1 = '01'mc''yr
>>>>>    time2 = md''mc''yr
>>>>> 'define monrf=sum(rf,time='time1',time='time2')'
>>>>> 'd monrf'
>>>>>
>>>>>   imon = imon + 1
>>>>>   endwhile
>>>>>
>>>>> val=subwrd(result,4)
>>>>> hj=write(monrf.csv,val)
>>>>>
>>>>>
>>>>> Regards
>>>>>
>>>>> On Mon, Mar 28, 2016 at 6:28 PM, Stephen McMillan <
>>>>> smcmillan at planalytics.com> wrote:
>>>>>
>>>>>> Gargi,
>>>>>> Instead of using "t= ...", use "time= ..." when you define the
>>>>>> precipitation variable.
>>>>>> Stephen
>>>>>>
>>>>>> On Mon, Mar 28, 2016 at 8:49 AM, Gargi Akhoury <
>>>>>> gargiakhoury at bitmesra.ac.in> wrote:
>>>>>>
>>>>>>> Hello Stephen,
>>>>>>>         I have corrected but still getting a single value......not
>>>>>>> the values for all 12 months separately.
>>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>> On Mon, Mar 28, 2016 at 6:02 PM, Stephen McMillan <
>>>>>>> smcmillan at planalytics.com> wrote:
>>>>>>>
>>>>>>>> Gargi,
>>>>>>>>
>>>>>>>> You are getting only January because your current script is
>>>>>>>> redefining "month" on the first iteration of the while loop.  Rename it to
>>>>>>>> something different, since it's already defined on the third line you
>>>>>>>> provided.
>>>>>>>>
>>>>>>>> Stephen Mc
>>>>>>>>
>>>>>>>> On Mon, Mar 28, 2016 at 7:51 AM, Gargi Akhoury <
>>>>>>>> gargiakhoury at bitmesra.ac.in> wrote:
>>>>>>>>
>>>>>>>>> Dear Grads User's,
>>>>>>>>>
>>>>>>>>>             I have tried a program to display the monthly sum of
>>>>>>>>> precipitation. But I am getting only the January value. Kindly, help me
>>>>>>>>> regarding this.
>>>>>>>>>
>>>>>>>>> Tha program is as follows:
>>>>>>>>>
>>>>>>>>> 'reinit'
>>>>>>>>>  mday = '31 28 31 30 31 30 31 31 30 31 30 31'
>>>>>>>>>  month = 'jan feb mar apr may jun jul aug sep oct nov dec'
>>>>>>>>>
>>>>>>>>> 'open rfc.ctl'
>>>>>>>>> *'set t 1 365'
>>>>>>>>>  yr = 1951
>>>>>>>>>
>>>>>>>>> imon=1
>>>>>>>>>   while(imon <= 12)
>>>>>>>>>    md = subwrd(mday,imon)
>>>>>>>>>    mc = subwrd(month,imon)
>>>>>>>>>   time1 = '01'mc''yr
>>>>>>>>>    time2 = md''mc''yr
>>>>>>>>> 'define month=sum(rf,t='time1',t='time2')'
>>>>>>>>>   imon = imon + 1
>>>>>>>>>   endwhile
>>>>>>>>> 'd month'
>>>>>>>>>
>>>>>>>>> val=subwrd(result,4)
>>>>>>>>> hj=write(rf_month.csv,val)
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks & Regards
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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/20160405/93dc6a01/attachment-0001.html 


More information about the gradsusr mailing list