Skip to content
Snippets Groups Projects
Commit fa937240 authored by Aaron Wienkers's avatar Aaron Wienkers
Browse files

Makes new daskicon class for more efficient processing by pointing directly to...

Makes new daskicon class for more efficient processing by pointing directly to the coeff files on disk
parent 1e312f75
No related branches found
No related tags found
No related merge requests found
Pipeline #84124 failed
......@@ -12,6 +12,7 @@ from .pyicon_params import params
from .pyicon_calc import *
#print('-----calc_xr')
from .pyicon_calc_xr import *
from .pyicon_calc_aw import *
#print('-----tb')
from .pyicon_tb import *
#print('-----IconData')
......
This diff is collapsed.
......@@ -513,7 +513,7 @@ def xr_cell2edges(ds_IcD, p_vn_c, edge2cell_coeff_cc_t=None):
).sum(
dim="cart"
)
return ptp_vn
return ptp_vn.chunk({'edge':-1}) # Ensure still in a single chunk...
## Mapping between edges and cells
......@@ -780,13 +780,17 @@ def xr_calc_grad(ds_IcD, scalar, grad_coeff=None):
grad_of_scalar : xr.DataArray
horizontal gradient of scalar at edges
"""
if grad_coeff is None:
grad_coeff = xr_calc_grad_coeff(ds_IcD)
adj_cell = ds_IcD.adjacent_cell_of_edge
grad_of_scalar = (
scalar.isel(cell=ds_IcD.adjacent_cell_of_edge.isel(nc_e=1))
- scalar.isel(cell=ds_IcD.adjacent_cell_of_edge.isel(nc_e=0))
scalar.isel(cell=adj_cell.isel(nc_e=1))
- scalar.isel(cell=adj_cell.isel(nc_e=0))
) * grad_coeff
return grad_of_scalar
return grad_of_scalar.chunk({'edge':-1}) # Ensure still in a single chunk...
# Curl
......@@ -859,7 +863,7 @@ def xr_calc_curl(ds_IcD, vector, rot_coeff=None):
)
else:
curl_vec = xr.apply_ufunc(
lambda v, ind: (v[ind] * rot_coeff).sum(dim='ne_v'),
lambda v, ind: (v[ind] * rot_coeff).sum(dim='ne_v'), # NOTE: This gives very large/wrong values when the vertex has _any_ neighbouring undefined cell....
vector,
eov,
input_core_dims=[['edge'], ['vertex','ne_v']],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment