def change_grid_location_u_to_t(self,scalararray,conserving='x_flux'):
"""Return a xarray corresponding to scalararray averaged at a new
grid location.
Parameters
----------
scalararray : xarray.DataArray
original array to be relocated
conserving : str
any of 'area', 'x_flux' or 'y_flux'.
- 'area' : conserves the area
- 'x_flux' : conserves the flux in x-direction (eastward)
- 'y_flux' : conserves the flux in y-direction (northward)
"""
check_input_array(scalararray,\
chunks=self.chunks,grid_location='u',ndims=self.ndims)
wi, wo = self._weights_for_change_grid_location(input='u',output='t',
conserving=conserving)
out = self._to_western_grid_location(scalararray,weights_in=wi,
weights_out=wo)
return _append_dataarray_extra_attrs(out,grid_location='t')
评论列表
文章目录