[gradsusr] maskout
Jeff Duda
jeffduda319 at gmail.com
Mon Aug 15 16:25:14 EDT 2016
If your mask is only valid at a single point, then that's the reason the
command isn't working. The mask needs to be a 2-D, 3-D, or 4-D field. The
maskout does a spatial and or temporal mask, not a numerical one at a
single point.
Jeff
On Mon, Aug 15, 2016 at 3:19 PM, Ally Toure <allytoure at gmail.com> wrote:
> Hi Jeff,
> Sorry to bother you again
>
> On the script below
> when I used the command *'d mask.3(t=1)', I see the mask the dot in red
> have value of 888 everywhere else is undefined
> when I comment line 15 and 16.
> I get the following error message:
>
> Error from AMEAN Invalid environment. Z, T, or E can't vary.
> Operation Error: Error from amean function
> Error ocurred at column 1
> DISPLAY error: Invalid expression
> Expression = amean(maskout(100*swed,mask.3(t=1)),x=1,x=98,y=1,y=129)
>
> Thanks
> Ally
>
>
>
>
> 1 'reinit'
> 2
> 3 'open ../outputs/snowpack.ctl'
> 4 'open ../../topo_veg/regrid/siksik_topo_veg_20m.ctl'
> 5 'open ../data/mask/obsmask_20m.ctl'
> 6 'open ../process/ave_swe_mask/ave_swe_mask.ctl'
> 7 'open ../../obs/sonic_sounder_149/snowd_daily_2012-2013.ctl'
> 8
> 9 'set grads off'
> 10 'set mproj scaled'
> 11 'set mpdraw off'
> 12
> 13 'set parea 1.0 7.5 1.0 9.56'
> 14
> 15 *'d mask.3(t=1)'
> 16 *return
> 17
> 18 'set vrange 0 15'
> 19
> 20 * plot the domain-averaged swe at each time step.
> 21 'set x 1'
> 22 'set y 1'
> 23 'set t 1 303'
> 24 'set cmark 0'
> 25 'd 100*sweave_wi.4'
> 26
> 27 'd amean(maskout(100*swed,mask.3(t=1)),x=1,x=98,y=1,y=129)'
> 28
>
>
> On Mon, Aug 15, 2016 at 2:33 PM, Jeff Duda <jeffduda319 at gmail.com> wrote:
>
>> Ally,
>> I see no indication in this code for why it won't work. When you said
>> that the line
>>
>> 'd tloop(amean(100*swed,x=1,x=98,y=1,y=129))'
>>
>> works, what do you mean? Does it plot a 1-D time series showing
>> reasonable values? Are there any error messages anywhere when you run this
>> code? If the line above works, but
>>
>> 'd tloop(amean(maskout(100*swed,mask.3(t=1)),x=1,x=98,y=1,y=129))'
>>
>> doesn't, then it means the inclusion of the maskout(100*swed,mask.3(t=1))
>> function is resulting an field that is entirely undefined. If swed itself
>> is defined everywhere, then it must be the case that either mask.3(t=1) is
>> all negative, or that mask field is itself undefined. Your mask might be
>> fine if you plot it in isolation, but remember that you're changing your
>> dimension environment throughout the script (to values that likely differ
>> from the defaults in the control files), and you have multiple files open
>> simultaneously, so that will impact whether a field is defined or not. You
>> can test if the mask is the problem by adding this line
>>
>> 'd mask.3(t=1)'
>>
>> immediately before your big display command (and then stop the code by
>> adding *return*). If the mask plots fine, then I'm missing something
>> else.
>>
>> Jeff
>>
>> On Mon, Aug 15, 2016 at 1:19 PM, Ally Toure <allytoure at gmail.com> wrote:
>>
>>> Here is the script
>>>
>>> 'reinit'
>>>
>>> 'open ../outputs/snowpack.ctl'
>>> 'open ../../topo_veg/regrid/siksik_topo_veg_20m.ctl'
>>> 'open ../process/ave_swe_mask/ave_swe_mask.ctl'
>>> 'open ../../obs/sonic_sounder_149/snowd_daily_2012-2013.ctl'
>>>
>>> 'set grads off'
>>> 'set mproj scaled'
>>> 'set mpdraw off'
>>>
>>> * the aspect ratio is 129/98=1.32.
>>> 'set parea 1.0 7.5 1.0 9.56'
>>>
>>> 'set t 1 303'
>>>
>>> * this is the grid cell corresponding to the met tower location.
>>> 'set x 31'
>>> 'set y 72'
>>>
>>> 'set vrange 0 15'
>>>
>>> * plot the domain-averaged swe at each time step.
>>>
>>> 'set x 1'
>>> 'set y 1'
>>> 'set t 1 303'
>>> 'd 100*sweave_wi.3'
>>>
>>> *'d tloop(amean(100*swed,x=1,x=98,y=1,y=129))'
>>> * pull dummy
>>> * something is wrong with this.
>>>
>>> *'d tloop(amean(maskout(100*swed,mask.3(t=1)),x=1,x=98,y=1,y=129))'
>>>
>>>
>>>
>>> Thanks
>>> Ally
>>>
>>>
>>>
>>>
>>>
>>> On Mon, Aug 15, 2016 at 1:59 PM, Jeff Duda <jeffduda319 at gmail.com>
>>> wrote:
>>>
>>>> mask.3 implies you've opened at least 3 data files and that the mask is
>>>> indeed in file #3. Can you verify this in your script code? Also make sure
>>>> the time in your two files matches up or you use a string to reset the time
>>>> to correspond to one of the fields. You used (t=1) for mask.3, but if t=1
>>>> does not represent 00Z 01 January 2001, then you'll have a time mismatch as
>>>> well. It doesn't appear this is the issue, though. It might help if you
>>>> sent your script code.
>>>>
>>>> On Mon, Aug 15, 2016 at 11:32 AM, Ally Toure <allytoure at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Jeff,
>>>>> I plotted the mask
>>>>> and it look fine for me. attached is the .ctl and .gdat file
>>>>>
>>>>> and there is the part of the code
>>>>> * plot the domain-averaged swe at each time step.
>>>>> 'set x 1'
>>>>> 'set y 1'
>>>>> 'set t 1 303'
>>>>> 'set cmark 0'
>>>>>
>>>>> This works
>>>>> 'd tloop(amean(100*swed,x=1,x=98,y=1,y=129))'
>>>>>
>>>>>
>>>>> * something is wrong with this.
>>>>> 'd tloop(amean(maskout(100*swed,mask.3(t=1)),x=1,x=98,y=1,y=129))'
>>>>>
>>>>> Thanks
>>>>> Ally
>>>>>
>>>>>
>>>>> On Mon, Aug 15, 2016 at 11:25 AM, Ally Toure <allytoure at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Jeff,
>>>>>> I will do that. Thanks again for your help.
>>>>>> Ally
>>>>>>
>>>>>> On Mon, Aug 15, 2016 at 11:12 AM, Jeff Duda <jeffduda319 at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> That makes it sound like your mask is negative in the entire domain
>>>>>>> over which you're trying to average. I would verify that the mask is what
>>>>>>> you want it to be.
>>>>>>>
>>>>>>> Jeff
>>>>>>>
>>>>>>> On Mon, Aug 15, 2016 at 9:32 AM, Ally Toure <allytoure at gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi Jeff,
>>>>>>>> I get a message such as "Entire grid undefined"
>>>>>>>> Thanks
>>>>>>>> Ally
>>>>>>>>
>>>>>>>> On Mon, Aug 15, 2016 at 1:24 AM, Jeff Duda <jeffduda319 at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> What are you actually seeing?
>>>>>>>>>
>>>>>>>>> On Sun, Aug 14, 2016 at 11:25 PM, Ally Toure <allytoure at gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi Jeff,
>>>>>>>>>> thanks so much for you prompt reply
>>>>>>>>>> I set up
>>>>>>>>>> 'set t 1 303'
>>>>>>>>>> 'd tloop(amean(maskout(100*swed,mask.3(t=1)),x=1,x=98,y=1,y=129
>>>>>>>>>> ))'
>>>>>>>>>>
>>>>>>>>>> it still does not work
>>>>>>>>>> What else should I change?
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> On Mon, Aug 15, 2016 at 12:02 AM, Jeff Duda <
>>>>>>>>>> jeffduda319 at gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> You probably need to set your dimension environment to 1-D by
>>>>>>>>>>> fixing lat/x and lon/y so that only t varies.
>>>>>>>>>>>
>>>>>>>>>>> Jeff Duda
>>>>>>>>>>>
>>>>>>>>>>> On Sun, Aug 14, 2016 at 10:52 PM, Ally Toure <
>>>>>>>>>>> allytoure at gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Guys,
>>>>>>>>>>>> I am trying to compute average of swed at points where the mask
>>>>>>>>>>>> value are positive. I used the command below but it won't plot the line.
>>>>>>>>>>>> Am I missing something? Your help would be greatly appreciated.
>>>>>>>>>>>>
>>>>>>>>>>>> * something is wrong with this.
>>>>>>>>>>>> 'set t 1'
>>>>>>>>>>>> 'd tloop(amean(maskout(100*swed,m
>>>>>>>>>>>> ask.3(t=1)),x=1,x=98,y=1,y=129))'
>>>>>>>>>>>>
>>>>>>>>>>>> Ally
>>>>>>>>>>>>
>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>> gradsusr mailing list
>>>>>>>>>>>> gradsusr at gradsusr.org
>>>>>>>>>>>> http://gradsusr.org/mailman/listinfo/gradsusr
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> Jeff Duda
>>>>>>>>>>> Post-doctoral research associate
>>>>>>>>>>> University of Oklahoma School of Meteorology
>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> 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
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Jeff Duda
>>>>>>>>> Post-doctoral research associate
>>>>>>>>> University of Oklahoma School of Meteorology
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Jeff Duda
>>>>>>> Post-doctoral research associate
>>>>>>> University of Oklahoma School of Meteorology
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Jeff Duda
>>>> Post-doctoral research associate
>>>> University of Oklahoma School of Meteorology
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>>
>> --
>> Jeff Duda
>> Post-doctoral research associate
>> University of Oklahoma School of Meteorology
>>
>> _______________________________________________
>> 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
>
>
--
Jeff Duda
Post-doctoral research associate
University of Oklahoma School of Meteorology
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://gradsusr.org/pipermail/gradsusr/attachments/20160815/0997af06/attachment-0001.html
More information about the gradsusr
mailing list