[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[IDV #DDI-412591]: subset field from map



Hi Tyn,

> Finally found time to start using the map routines.
> 
> How should I use it, for example an average for each polygon from a
> field:
> 
> This jython function:
> 
> mapsApplyToField(function, field, mapSets,inside)
> 
> could do the job, but I'm not quite sure how to feed the function. Like
> this maybe (see example formula below)?
> 
The function argument is the string name of the jython function.
So, for example:

def averageFromMap(field,mapSets):
        return mapsApplyToField('mapsAverage', field, mapSets,1);

The mapsApplyToField knows how to get the indices of the given field (the "1" 
says to use the indices inside the polygons), step through each time step, 
evaluate the function and return the result.

It turns out I never did finish this up and the actual application of the 
function was failing.
This is (or will be) fixed now.

You could also do, for example:

def averageFromMapAndClip(field,mapSets):
        return subsetFromMap(mapsApplyToField('mapsAverage', field, mapSets,1), 
mapSets);

This takes the result of the average and then removes from the field (well, set 
to NaN) anything that is not inside the map.

In tonites nightly build look at the maps.py library.

Please share with us any other ideas you might have for new functions.

-Jeff



Ticket Details
===================
Ticket ID: DDI-412591
Department: Support IDV
Priority: Critical
Status: Closed