For each field, return weights for the data array values.
By default weights components are created for all axes of the field by one or more of the following methods, in order of preference:
- Volume cell measures
- Area cell measures
- Area calculated from (grid) latitude and (grid) longitude dimension coordinates with bounds
- Cell sizes of dimension coordinates with bounds
- Equal weights
and the outer product of the weights components is returned in a field which is broadcastable to the orginal field (see the components parameter).
The methods used by the default behaviour may differ between fields, depending on which metadata they contain (see the methods parameter), so it is possible to force weights to be created with particular methods (see the weights parameter).
New in version 1.0.
See also
cell_area, collapse
Examples 1: |
---|
>>> g = f.weights()
Parameters: |
|
||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Returns: |
|
||||||||||||||||
Examples 2: |
>>> f
[<CF Field: air_temperature(time(1800), latitude(145), longitude(192)) K>]
>>> f.weights()
[<CF Field: long_name:weight(time(1800), latitude(145), longitude(192)) 86400 s.rad>]
>>> f.weights('auto', scale=True)
[<CF Field: long_name:weight(time(1800), latitude(145), longitude(192)) 1>]