Is there a quick way to get the 10 smallest and 10 largest values from data arrays in McV?
Thanks,
Joleen
Data Extreme Values
Re: Data Extreme Values
Hi Joleen -
Here's one way I found of doing this:
Is this along the lines of what you are looking for?
Thanks -
Bob Carp
Here's one way I found of doing this:
Code: Select all
# create a data object
addeParms = dict(
server = 'adde.ucar.edu',
dataset = 'RTIMAGES',
descriptor = 'GE-IR',
coordinateSystem = LATLON,
location = (40,-80),
size = (20,20),
unit = 'TEMP',
)
data = loadADDEImage(**addeParms)
# get values of data, this is an array
dataValues = data.getValues()
# print the original dataValues array
print dataValues[0]
# sort the array values into a list
sortedDataValues = sorted(dataValues[0])
print sortedDataValues
# use slicing to extract the 10 lowest values
tenMinVals = sortedDataValues[0:10]
print tenMinVals
# use slicing to extract the 10 highest values
tenMaxVals = sortedDataValues[-10:]
print tenMaxVals
Is this along the lines of what you are looking for?
Thanks -
Bob Carp
Re: Data Extreme Values
Bob,
That should work.
Thanks,
Joleen
That should work.
Thanks,
Joleen