-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Hello,
Here is my example: I am reading a u,v field, respectively on U-grid and V-grid but also with respective vertical coordinates: depthu and depthv. I want to compute curl, which will be centered on f-grid. I point out that the issue is similar with vector norm (centered on T-grid)
vec_xr = gridsc.VectorField2d(vi_xr, vj_xr,
x_component_grid_location='u',
y_component_grid_location='v')
#EE mode
vcurl_xr=grd.vertical_component_of_curl(vec_xr)
print vi_xr
print vj_xr
print vec_xr
print vcurl_xr
Here is the output:
<xarray.DataArray (t: 5, depthu: 19, y: 3454, x: 5422)>
dask.array<elemwis..., shape=(5, 19, 3454, 5422), dtype=float64, chunksize=(1, 1, 1727, 2711)>
Coordinates:
nav_lat (y, x) float32 26.5648 26.5648 26.5648 26.5648 26.5648 ...
nav_lon (y, x) float32 -81.4512 -81.4346 -81.4179 -81.4012 ...
* depthu (depthu) float32 0.480455 1.55879 2.79421 4.18731 5.73867 ...
* x (x) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* t (t) datetime64[ns] 2008-01-07T12:00:00 ...
time_centered (t) datetime64[ns] 2008-01-07T12:00:00 ...
Attributes:
grid_location: u
<xarray.DataArray (t: 5, depthv: 19, y: 3454, x: 5422)>
dask.array<elemwis..., shape=(5, 19, 3454, 5422), dtype=float64, chunksize=(1, 1, 1727, 2711)>
Coordinates:
nav_lat (y, x) float32 26.5648 26.5648 26.5648 26.5648 26.5648 ...
nav_lon (y, x) float32 -81.4512 -81.4346 -81.4179 -81.4012 ...
* depthv (depthv) float32 0.480455 1.55879 2.79421 4.18731 5.73867 ...
* x (x) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* t (t) datetime64[ns] 2008-01-07T12:00:00 ...
time_centered (t) datetime64[ns] 2008-01-07T12:00:00 ...
Attributes:
grid_location: v
VectorField2d(x_component=<xarray.DataArray (t: 5, depthu: 19, y: 3454, x: 5422)>
dask.array<elemwis..., shape=(5, 19, 3454, 5422), dtype=float64, chunksize=(1, 1, 1727, 2711)>
Coordinates:
nav_lat (y, x) float32 26.5648 26.5648 26.5648 26.5648 26.5648 ...
nav_lon (y, x) float32 -81.4512 -81.4346 -81.4179 -81.4012 ...
* depthu (depthu) float32 0.480455 1.55879 2.79421 4.18731 5.73867 ...
* x (x) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* t (t) datetime64[ns] 2008-01-07T12:00:00 ...
time_centered (t) datetime64[ns] 2008-01-07T12:00:00 ...
Attributes:
grid_location: u, y_component=<xarray.DataArray (t: 5, depthv: 19, y: 3454, x: 5422)>
dask.array<elemwis..., shape=(5, 19, 3454, 5422), dtype=float64, chunksize=(1, 1, 1727, 2711)>
Coordinates:
nav_lat (y, x) float32 26.5648 26.5648 26.5648 26.5648 26.5648 ...
nav_lon (y, x) float32 -81.4512 -81.4346 -81.4179 -81.4012 ...
* depthv (depthv) float32 0.480455 1.55879 2.79421 4.18731 5.73867 ...
* x (x) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* t (t) datetime64[ns] 2008-01-07T12:00:00 ...
time_centered (t) datetime64[ns] 2008-01-07T12:00:00 ...
Attributes:
grid_location: v, x_component_grid_location='u', y_component_grid_location='v')
<xarray.DataArray 'vertical component of the curl' (t: 5, depthv: 19, y: 3454, x: 5422, depthu: 19)>
dask.array<elemwis..., shape=(5, 19, 3454, 5422, 19), dtype=float64, chunksize=(1, 1, 1727, 2711, 1)>
Coordinates:
* depthv (depthv) float32 0.480455 1.55879 2.79421 4.18731 5.73867 ...
* x (x) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* y (y) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ...
* t (t) datetime64[ns] 2008-01-07T12:00:00 ...
time_centered (t) datetime64[ns] 2008-01-07T12:00:00 ...
* depthu (depthu) float32 0.480455 1.55879 2.79421 4.18731 5.73867 ...
Attributes:
grid_location: f
Original coordinates of the u,v components are broadcast through the operation (here, curl) and the result is a 4-coordinate variable.
It can be very consequent in memory and writing operations, because it creates a 4-D variable which is N times bigger than the expected 3-D variable, with N as the vertical size.
Best regards,
Simon
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels