Closed lee1043 closed 4 months ago
I don't know if this was already considered in #533. @jasonb5 @tomvothecoder could you please remind me?
@lee1043 I will check, this may be resolved with #533.
Hey @jasonb5, did you confirm whether or not this was fixed in #533?
@tomvothecoder @lee1043 With #533 I had to adjust the example to
import xcdat as xc
!wget https://www.ncei.noaa.gov/data/sea-surface-temperature-optimum-interpolation/v2.1/access/avhrr/198109/oisst-avhrr-v02r01.19810901.nc
input_data = "oisst-avhrr-v02r01.19810901.nc"
ds = xc.open_dataset(input_data)
# Needs axis attribute for cf_xarray
ds["lat"].attrs["axis"] = "Y"
ds["lon"].attrs["axis"] = "X"
ds["time"].attrs["axis"] = "T"
# Make a target grid to interpolate to
target_grid = xc.create_uniform_grid(-90, 90, 5, 2.5, 357.5, 5)
target_grid
ds_regridded_regrid2 = ds.regridder.horizontal("sst", target_grid, tool="regrid2")
and it worked correctly.
The above @jasonb5's code is working with #533. Thank you @jasonb5
From my understanding, this issue is related to missing CF attributes for this specific dataset.
Is that correct? If so, we can probably close this issue.
@tomvothecoder agreed.
What happened?
regrid2
returns error when input field for interpolation does not have time axis. In below example, I am interpolating a 2d spatial field, a time snapshat.xesmf
works fine for the case.What did you expect to happen? Are there are possible answers you came across?
When time axis does not exist, regrid process should only regrid that field (single time step).
Minimal Complete Verifiable Example (MVCE)
Relevant log output
Anything else we need to know?
No response
Environment
xcdat: 0.6.1
xr.show_versions()
``` INSTALLED VERSIONS ------------------ commit: None python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:17:34) [Clang 14.0.6 ] python-bits: 64 OS: Darwin OS-release: 22.6.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: (None, 'UTF-8') libhdf5: 1.14.2 libnetcdf: 4.9.2 xarray: 2023.11.0 pandas: 2.1.3 numpy: 1.23.5 scipy: 1.11.4 netCDF4: 1.6.5 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.6.3 nc_time_axis: 1.4.1 iris: None bottleneck: None dask: 2023.12.0 distributed: 2023.12.0 matplotlib: 3.7.1 cartopy: 0.22.0 seaborn: 0.12.2 numbagg: None fsspec: 2023.12.0 cupy: None pint: None sparse: 0.14.0 flox: None numpy_groupies: None setuptools: 67.7.2 pip: 23.1.2 conda: None pytest: None mypy: None IPython: 8.18.1 sphinx: None [/Users/lee1043/mambaforge/envs/enso_metrics_dev_20231204/lib/python3.10/site-packages/_distutils_hack/__init__.py:33](https://file+.vscode-resource.vscode-cdn.net/Users/lee1043/mambaforge/envs/enso_metrics_dev_20231204/lib/python3.10/site-packages/_distutils_hack/__init__.py:33): UserWarning: Setuptools is replacing distutils. warnings.warn("Setuptools is replacing distutils.") ```