This shows you the differences between two versions of the page.
Next revision Both sides next revision | |||
howtos:toolcoding:many_to_one_mapping_with_non_summation_aggregation_rule [2010/04/20 19:33] deryn.crockett created |
howtos:toolcoding:many_to_one_mapping_with_non_summation_aggregation_rule [2010/04/20 19:37] deryn.crockett |
||
---|---|---|---|
Line 1: | Line 1: | ||
The map tool can perform an index mapping in which multiple elements of informant X are mapped to the same element of informant Y. To aggregate multiple elements into one, the map tool sums the values of the composite elements. However, there may be a need to use a different aggregation function such as minimum, maximum, or average. The following code demonstrates how to implement this logic. | The map tool can perform an index mapping in which multiple elements of informant X are mapped to the same element of informant Y. To aggregate multiple elements into one, the map tool sums the values of the composite elements. However, there may be a need to use a different aggregation function such as minimum, maximum, or average. The following code demonstrates how to implement this logic. | ||
- | <code - myfile.t> | + | <code> |
- | local uce2020[uce2020,uce2020] = diag (1.0; dim=unitCodeE2020) | + | |
- | local uce2020Mask[t,cidsc->unsc,uce2020] = boolne (dimtran (uce2020[uce2020,uce2020]; \ | + | |
- | map1=E2020UnitCodeIndx[t,cidsc->unsc], newDims=2, checkData=off),0) | + | |
- | local comYrsSCx[t,cidsc->unsc,uce2020] = reorder (comYrsSC[cidsc->unsc,t]; time, cidscCOunsc) * \ | + | |
- | uce2020Mask[t,cidsc->unsc,uce2020] | + | |
- | local comYrsSCOffset[t,cidsc->unsc,uce2020] = booleq (comYrsSCx[t,cidsc->unsc,uce2020],0) * 9999 | + | |
- | local comYrsSCy[t,cidsc->unsc,uce2020] = comYrsSCx[t,cidsc->unsc,uce2020] + comYrsSCOffset[t,cidsc->unsc,uce2020] | + | |
- | local e2020OnlineDatex[uce2020,t] = coordmin (reorder (comYrsSCy[t,cidsc->unsc,uce2020]; unitCodeE2020,time,cidscCOunsc); numDims=1) | ||
- | e2020OnlineDate[uce2020,t] = boolne (e2020OnlineDatex[uce2020,t],9999) * e2020OnlineDatex[uce2020,t] | ||
</code> | </code> |