[ncl-talk] local_max and missing values
Teresa Parker
tess.parker at monash.edu
Mon Jun 8 03:34:36 MDT 2015
Thank you Dennis. I'll try a version of your suggestion.
--
Tess Parker
PhD Candidate
School of Earth, Atmosphere and Environment
Room 225, Building 28
9 Rainforest Walk
Monash University, Clayton VIC 3800
Phone: +61 3 9905 4458
http://users.monash.edu.au/~tess/index.html
On 6 June 2015 at 19:37, Dennis Shea <shea at ucar.edu> wrote:
> The very simple algorithm used does not handle boundary cases.
>
> My suggestion:
>
> Use the function on the global grid, then set all location N/N of 30 to
> _FillValue.
>
> HTH
>
> On Fri, Jun 5, 2015 at 2:33 AM, Teresa Parker <tess.parker at monash.edu>
> wrote:
>
>> Hi - I'm using the local_max function to find local maxima in a variable
>> field. The variable covers all longitudes, but is calculated for a 30 deg
>> latitude band only. All values outside this latitude band are set to the
>> @_FillValue for the variable.
>>
>> Where the local maximum for the variable is located well within the
>> latitude band, there is no problem However, when the local maximum is
>> located on the edge of the latitude band (i.e. at either the minimum or
>> maximum latitude of the band), the function fails. This seems to be because
>> the immediately neighbouring points are all "missing" values. However, the
>> function documentation states that missing values are ignored.
>>
>> This can be seen from a simple example:
>> *************************************************
>> begin
>>
>> myvar = new((/3,3/),float)
>> myvar at _FillValue = -999.
>> myvar = (/ (/-999.0,-999.0,-999.0/),(/60,70,55/),(/43,45,23/)/)
>> print(myvar)
>> mymax = local_max(myvar, False, 0.0)
>> print(mymax)
>>
>> mymaxval = mymax at maxval
>> print(mymaxval)
>>
>> end
>>
>> However, if the missing values are set to e.g. zero, the function works:
>> *********************************************************************
>> begin
>>
>> myvar = new((/3,3/),float)
>> myvar at _FillValue = -999.
>> myvar = (/ (/0.0,0.0,0.0/),(/60,70,55/),(/43,45,23/)/)
>> print(myvar)
>> mymax = local_max(myvar, False, 0.0)
>> print(mymax)
>>
>> mymaxval = mymax at maxvalmymaxval = mymax at maxval
>> print(mymaxval)
>>
>> end
>>
>> While it might seem to be an easy workaround to set the next highest and
>> lowest latitude band values to some miniscule value, this shouldn't really
>> be necessary for the function to work. Can anyone help?
>>
>> --
>> Tess Parker
>> PhD Candidate
>> School of Earth, Atmosphere and Environment
>> Room 225, Building 28
>> 9 Rainforest Walk
>> Monash University, Clayton VIC 3800
>> Phone: +61 3 9905 4458
>> http://users.monash.edu.au/~tess/index.html
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150608/574575b8/attachment.html
More information about the ncl-talk
mailing list