You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working with netCDF files that have a spatial resolution of 1.25 degrees. However, on some of these files, the coordinates have a trailing float so that -88.75 becomes -88.750008 etc. When using xr.open_mfdataset, this means that rather than having lat/lon dimensions of (145, 288) like I would see on a single file, I have lat/lon dimensions of (230, 467) and nans interspersed throughout the dataset due to misaligned grids. Therefore, it would be useful to be able to limit the number of trailing digits to 2 or 3 so that I don't run into this issue in the future!
MCVE Code Sample
d_mf=xa.open_mfdataset(flist_rean['JRA'])
v1=d_mf['ua'].isel(time=0,plev=21)
print(v1)
# which returns:<xarray.DataArray'ua' (lat: 230, lon: 467)>dask.array<shape=(230, 467), dtype=float32, chunksize=(230, 467)>Coordinates:
*lat (lat) float64-90.0-88.75-88.75-87.5 ... 88.7588.7590.090.0*lon (lon) float640.01.252.53.753.75 ... 357.5357.5358.8358.8#... etc. As you can see, there are multiple values for these coordinates!#if we look at the values:v1.valuesarray([[-15.603317 , -15.665817 , -15.728317 , ..., -15.447067 ,
nan, -15.540817 ],...#truncated for ease of viewing
Expected Output
#This is opening a single filex1=xa.open_dataset(flist_rean['JRA'][0]).isel(time=0,plev=21)
print(x1)
<xarray.Dataset>Dimensions: (lat: 145, lon: 288)
Coordinates:
*lat (lat) float3290.0000188.75001 ... -88.75001-90.0*lon (lon) float320.01.252.5 ... 357.50003358.75003x1['ua'].valuesarray([[-15.603317 , -15.665817 , -15.728317 , ..., -15.384567 ,
-15.447067 , -15.540817 ],...#truncated for ease of viewing
Problem Description
I'm working with netCDF files that have a spatial resolution of 1.25 degrees. However, on some of these files, the coordinates have a trailing float so that -88.75 becomes -88.750008 etc. When using
xr.open_mfdataset
, this means that rather than having lat/lon dimensions of (145, 288) like I would see on a single file, I have lat/lon dimensions of (230, 467) and nans interspersed throughout the dataset due to misaligned grids. Therefore, it would be useful to be able to limit the number of trailing digits to 2 or 3 so that I don't run into this issue in the future!MCVE Code Sample
Expected Output
Output of
xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.12.14-150.27-default
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.4
libnetcdf: 4.6.1
xarray: 0.11.3
pandas: 0.24.2
numpy: 1.16.2
scipy: 1.2.1
netCDF4: 1.4.2
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.0.3.4
PseudonetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
cyordereddict: None
dask: 1.1.5
distributed: None
matplotlib: 3.0.3
cartopy: None
seaborn: 0.9.0
setuptools: 40.8.0
pip: 19.0.3
conda: None
pytest: None
IPython: 7.4.0
sphinx: None
The text was updated successfully, but these errors were encountered: