[gradsusr] Script errors
Murphy, Darren W
dwmurphy at nps.edu
Mon Jan 10 11:38:54 EST 2011
Austin,
Thanks for checking out the script. I had been doing some testing of the
script and changing the logic to check to see if it was by default entering
the statement. I forgot to change it back. Those lines should read...
>> if (minval > 0)
>> prompt 'minval greater than 0'
The problem persists though. With minval of -0.52 it still enters the
minval>0 statement.
Thanks,
Darren
On 1/10/11 7:57 AM, "Austin Conaty" <Austin.L.Conaty at nasa.gov> wrote:
> Darren,
>
> if (minval <= 0)
> prompt 'minval greater than 0'
>
> I think this is where you have a logic problem
>
> If minval less than or equal to zero
> prompt minval greater than zero
>
> Is this really what you mean to do?
>
> Murphy, Darren W wrote:
>> All,
>>
>> I¹m using Grads 2.0.a9.
>>
>> The script below throws a couple of errors. Earlier I thought it was an
>> string
>> not compatible with numeric calculations. Following Jeff Duda¹s (Thank you
>> Jeff) advice I found some errors in the script syntax. I can verify that the
>> script is accepting the user input, and that that the ³maxval² and ³minval²
>> values are correct.
>>
>> The first issue is the if statements. I have a value of minval being -.52
>> and
>> still entering the if statement for minval greater than 0.
>>
>> Second I am getting an error ³SET error: Missing or invalid arguments for
>> CLEVS
>> option². I can also verify that the cvals1 through cval8 are being
>> calculated,
>> but perhaps I have a syntax error on that line?
>>
>> Thank you,
>> Darren
>>
>>
>>
>> prompt 'Enter EOF #: '
>> pull EF
>>
>> eofnum = EF
>>
>> 'clear'
>> 'set poli on'
>> 'set ccolor 0'
>>
>> 'open
>> /Users/Darren/Desktop/output/MaxT_2x2x1dy_NormByMeanSTD_Afg_1979to2009_1to365
>> _EOF_eof.ctl'
>>
>> 'q dims'
>> res2 = sublin(result,2)
>> res3 = sublin(result,3)
>> lon1 = subwrd(res2,6)
>> lon2 = subwrd(res2,8)
>> lat1 = subwrd(res3,6)
>> lat2 = subwrd(res3,8)
>>
>> 'set z 'eofnum
>>
>> 'maxval = max(max(eof,lon='lon1',lon='lon2'),lat='lat1',lat='lat2')'
>> 'minval = min(min(eof,lon='lon1',lon='lon2'),lat='lat1',lat='lat2')'
>>
>> * BLUE shades
>> 'set rgb 16 0 0 255'
>> 'set rgb 17 55 55 255'
>> 'set rgb 18 110 110 255'
>> 'set rgb 19 165 165 255'
>> 'set rgb 20 220 220 255'
>>
>> * RED shades
>> 'set rgb 21 255 220 220'
>> 'set rgb 22 255 165 165'
>> 'set rgb 23 255 110 110'
>> 'set rgb 24 255 55 55'
>> 'set rgb 25 255 0 0'
>>
>> 'cval1 = 'minval'/5*4'
>> 'cval2 = 'minval'/5*3'
>> 'cval3 = 'minval'/5*2'
>> 'cval4 = 'minval'/5*1'
>>
>> 'cval5 = 'maxval'/5*1'
>> 'cval6 = 'maxval'/5*2'
>> 'cval7 = 'maxval'/5*3'
>> 'cval8 = 'maxval'/5*4'
>>
>> if (minval <= 0)
>> prompt 'minval greater than 0'
>> 'minval = 0'
>> 'cval1 = 'maxval'/10*1'
>> 'cval2 = 'maxval'/10*2'
>> 'cval3 = 'maxval'/10*3'
>> 'cval4 = 'maxval'/10*4'
>> 'cval5 = 'maxval'/10*5'
>> 'cval6 = 'maxval'/10*6'
>> 'cval7 = 'maxval'/10*7'
>> 'cval8 = 'maxval'/10*8'
>>
>> endif
>>
>> if (maxval < 0)
>> prompt 'maxval less than 0 '
>> 'maxval = 0'
>> 'cval1 = 'minval'/10*8'
>> 'cval2 = 'minval'/10*7'
>> 'cval3 = 'minval'/10*6'
>> 'cval4 = 'minval'/10*5'
>> 'cval5 = 'minval'/10*4'
>> 'cval6 = 'minval'/10*3'
>> 'cval7 = 'minval'/10*2'
>> 'cval8 = 'minval'/10*1'
>>
>> endif
>>
>> 'set gxout shaded'
>> 'set clevs minval cval1 cval2 cval3 cval4 cval5 cval6 cval7 cval8 maxval'
>> 'set ccols 16 17 18 19 20 1 21 22 23 24 25'
>>
>> 'set mpt * off'
>> 'set mpdset hires'
>> 'set mpt 0 0 1 7'
>> 'set mpt 1 0 1 7'
>> 'draw map'
>>
>> 'set background 1'
>> 'set annot 0 5'
>> 'd eof(z='eofnum')'
>>
>> 'run /Users/Darren/Desktop/cbarm.gs'
>>
>>
>> 'close 1'
>>
>
More information about the gradsusr
mailing list