-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: ValueError: Cannot generate bounds for a coordinate of length <= 1. Using decode_times optional arg #304
Comments
@durack1 - can you provide some more details about the file metadata or a http/thredds link/path to the file? I think xcdat 0.3.1 may fix the first issue, but I'm not sure why the second issue is occurring. |
This should get you there, although I have this data local too |
The file can be downloaded from here. I think the time units issue is fixed with this PR. The bounds issue is because this file has one time step and xcdat can't figure out how to generate bounds in that case. I think a reasonable fix would be to modify this line to log a warning and return the dataset as is. @durack1 - would you be willing to try a PR on this (assuming @tomvothecoder agrees with this solution)? The contributing guide is pretty complete (and would give you the latest xcdat environment since you would like to use some of the bug fixes on 0.3.1). |
@pochedls sure thing - happy to be a test bunny. I did pull down and create an xcdat_dev env last night following the instructions from https://xcdat.readthedocs.io/en/stable/contributing.html#local-development and attempted to build the env using As an aside, I was keen to pull down the changes in bump/0.3.1 and give this a whirl, but was stumped. I know this is not merged into As a second aside, garbled files such as this example (the time units are all wrong, should be ~1986, not 2359) would be useful a fringe test suite files |
This is fixed by #307.
As mentioned, this is not merged into We decided to go for rapid release cycles over nightly conda builds. Will provide a follow up the reasoning for this decision in #269 soon. |
If you are interested @durack1, I can give you write access to this repository so you don't need to work on a separate fork. |
@tomvothecoder sure, hook me up! |
@durack1 Just added you! Thanks for the help! |
@pochedls I am running on the latest Interestingly, the merge of #283 has led to the previous |
@durack1 - This should be fixed on the main branch. |
@pochedls @tomvothecoder excellent, thanks gents. I'll pull down the latest main later this week! |
What happened?
Attempting to open a dataset with
time:units = "months since 1955-01-01 00:00:00" ;
has problems, addingdecode_times=False
gets around the pandas issue (#282), but this leads to axcdat/bounds.py
issue instead:ValueError: Cannot generate bounds for a coordinate of length <= 1.
What did you expect to happen?
xcdat could handle the poorly formed file and open the dataset.
Minimal Complete Verifiable Example
Relevant log output
Anything else we need to know?
Adding the additional argument
opens the file fine
Environment
0.3.0 - conda-forge build
In [12]: xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:04:59) [GCC 10.3.0]
python-bits: 64
OS: Linux
OS-release: 3.10.0-1160.62.1.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.2
libnetcdf: 4.8.1
xarray: 2022.6.0
pandas: 1.4.3
numpy: 1.22.4
scipy: 1.9.0
netCDF4: 1.6.0
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.6.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2022.8.0
distributed: 2022.8.0
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: 2022.7.1
cupy: None
pint: None
sparse: 0.13.0
flox: None
numpy_groupies: None
setuptools: 63.4.2
pip: 22.2.2
conda: None
pytest: None
IPython: 7.33.0
sphinx: 5.1.1
~/mambaforge/envs/xcdat031spy532/lib/python3.10/site-packages/_distutils_hack/init.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
The text was updated successfully, but these errors were encountered: