Conversation
|
The file Pac_POP0.1_JRA_IAF_1993-12-6-test.nc does not have DZU and DZT, those variables are added from a separate grid file. |
I would set them to zero, but it should not really matter as there should not be any model output below KMT - the model does not compute anything there, as it would be in the ocean floor. |
😯my bad! I missed what followed after opening # open sample data
filepath = pop_tools.DATASETS.fetch('Pac_POP0.1_JRA_IAF_1993-12-6-test.nc')
ds = xr.open_dataset(filepath)
# get DZU and DZT, needed for operations later on
filepath_g = pop_tools.DATASETS.fetch('Pac_grid_pbc_1301x305x62.tx01_62l.2013-07-13.nc')
ds_g = xr.open_dataset(filepath_g)
ds["DZT"] = ds_g.DZT
ds["DZU"] = ds_g.DZU |
|
@andersy005 the test dataset is 5GB in netCDF form but 120MB in zarr (!) It's on the CGD machines at Can we get zarr files to work with |
|
gentle ping @andersy005 |
|
@dcherian, Sorry for not getting back to you sooner (somehow I didn't get the original notification).
Yes. We will need to zip it on the ftp server, and during the fetch step, it will be decompressed. I will look into this today, and will get back to you when it's ready. |
|
@dcherian, the zarr store is now on the FTP server. When you get a chance, merge master into your branch, and try the following: In [2]: from pop_tools.datasets import DATASETS, UnzipZarr
In [4]: import xarray as xr
In [5]: zstore = DATASETS.fetch('comp-grid.tx9.1v3.20170718.zarr.zip', proce
...: ssor=UnzipZarr())
In [6]: ds = xr.open_zarr(zstore)
In [7]: ds
Out[7]:
<xarray.Dataset>
Dimensions: (nlat: 2400, nlon: 3600, z_t: 62)
Coordinates:
* z_t (z_t) float32 500.0 1500.0 2500.0 ... 537500.0 562499.06 587499.06
Dimensions without coordinates: nlat, nlon
Data variables:
DZBC (nlat, nlon) float32 dask.array<chunksize=(300, 900), meta=np.ndarray>
DZT (z_t, nlat, nlon) float64 dask.array<chunksize=(4, 300, 450), meta=np.ndarray>
DZU (z_t, nlat, nlon) float64 dask.array<chunksize=(4, 300, 450), meta=np.ndarray>
KMT (nlat, nlon) float64 dask.array<chunksize=(300, 900), meta=np.ndarray>
KMU (nlat, nlon) float64 dask.array<chunksize=(300, 900), meta=np.ndarray>
dz (z_t) float32 dask.array<chunksize=(62,), meta=np.ndarray>
Attributes:
Conventions: CF-1.0; http://www.cgd.ucar.edu/cms/eaton/net...
NCO: netCDF Operators version 4.7.9 (Homepage = ht...
calendar: All years have exactly 365 days.
cell_methods: cell_methods = time: mean ==> the variable va...
contents: Diagnostic and Prognostic Variables
history: Thu Apr 2 17:17:40 2020: ncks -D 3 dzt_dzu_g...
history_of_appended_files: Thu Apr 2 17:17:40 2020: Appended file dzt_d... |
|
Very impressive @andersy005 ! That worked pretty easily. |
|
Looks like we need to bump up time limit on the CI |
I SSH-ed into the test container and ran the failing test line by line. Everything ran until In [1]: from pop_tools.datasets import UnzipZarr
In [2]: from pop_tools import DATASETS
In [3]: zstore = DATASETS.fetch('comp-grid.tx9.1v3.20170718.zarr.zip', processor
...: =UnzipZarr())
In [4]: import xarray as xr
In [5]: ds = xr.open_zarr(zstore)
In [6]: import pop_tools
In [7]: dzu, dzt = pop_tools.grid.calc_dzu_dzt(ds)
<frozen importlib._bootstrap>:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
In [8]: dzu, dzt
Out[8]:
(<xarray.DataArray 'DZT' (z_t: 62, nlat: 2400, nlon: 3600)>
dask.array<where, shape=(62, 2400, 3600), dtype=float32, chunksize=(62, 300, 900), chunktype=numpy.ndarray>
Coordinates:
* z_t (z_t) float32 500.0 1500.0 2500.0 ... 537500.0 562499.06 587499.06
Dimensions without coordinates: nlat, nlon,
<xarray.DataArray 'DZU' (z_t: 62, nlat: 2400, nlon: 3600)>
dask.array<where, shape=(62, 2400, 3600), dtype=float32, chunksize=(62, 300, 900), chunktype=numpy.ndarray>
Coordinates:
* z_t (z_t) float32 500.0 1500.0 2500.0 ... 537500.0 562499.06 587499.06
Dimensions without coordinates: nlat, nlon)
In [9]: from xarray.testing import assert_equal
In [10]: assert_equal(dzu, ds['DZU'])In [11]: assert_equal(dzt, ds['DZT'])
Killed |
|
OK I'll try to come up with a workaround. |
|
Before merging, see #56. We should link these functions to |
|
Should make this bit from the tracer budget notebook redundant |
* upstream/master: 📚 New docs theme & Add comments (NCAR#74)
The following (untested) code replaces nested |
|
Thanks Keith, this PR doesn't address the |
|
linting failure is some infrastructure thing. |
|
|
||
| .. warning:: | ||
|
|
||
| This function does not do the right thing at the tripole grid seam. |
There was a problem hiding this comment.
Is this out of scope? At this point, the tripole grid is the only one that we use partial bottom cells with.
I have treated the tripole seam in other instance where I am using roll like this:
# the tripole grid is periodic at the top: the left half of the top row maps to the
# right half. If `ltripole == True`, I replace the bottom row of the
# `KMT` array with the top row flipped left-to-right.
kmt_rollable = ds.KMT.copy()
if ltripole:
kmt_rollable[0, :] = kmt_rollable[-1, ::-1]A similar treatment could be applied here, though would need to be implemented as compatible with your numba_4pt_min.
|
Hi Sir/Lady: |

DZTat points belowKMT?: set to nominaldzDZTandDZUprecomputed.