reprojecting xarray dataset: TypeError: only length-1 arrays can be converted to Python scalars
I'm trying to reproject ERA5 data from lon/lat (EPSG:4326) to New Zealand Transverse Mercator (EPSG:2193). I'm getting "TypeError: only length-1 arrays can be converted to Python scalars" from reproject. As far as I can tell my usage and data are quite analogous to this example in the documentation.
Code Sample, a copy-pastable example if possible
A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
In [4]: data_out
Out[4]:
<xarray.DataArray (time: 2, y: 2400, x: 2400)> Size: 92MB
array([[[ 0. , 0. , 0. , ...,
0. , 0. , 0. ],
[ 0. , 0. , 0. , ...,
0. , 0. , 0. ],
[ 0. , 0. , 0. , ...,
0. , 0. , 0. ],
...,
[3102745.32245305, 3099395.65992008, 3096046.04169629, ...,
0. , 0. , 0. ],
[3097108.93459378, 3093759.06215556, 3090409.23388688, ...,
0. , 0. , 0. ],
[3091471.03450028, 3088120.95185706, 3084770.91324366, ...,
0. , 0. , 0. ]],
[[ 0. , 0. , 0. , ...,
0. , 0. , 0. ],
[ 0. , 0. , 0. , ...,
0. , 0. , 0. ],
[ 0. , 0. , 0. , ...,
0. , 0. , 0. ],
...,
[3281400.8388549 , 3278053.05613346, 3274705.25451338, ...,
0. , 0. , 0. ],
[3274617.22569414, 3271274.50480555, 3267931.76674866, ...,
0. , 0. , 0. ],
[3267852.4005159 , 3264514.74535506, 3261177.0747575 , ...,
0. , 0. , 0. ]]])
Coordinates:
* time (time) datetime64[ns] 16B 2022-01-01 2022-01-01T01:00:00
x (y, x) float64 46MB 150.1 150.1 150.1 ... -177.3 -177.3 -177.3
y (y, x) float64 46MB -30.0 -30.0 -30.0 ... -40.0 -40.0 -40.0
spatial_ref int64 8B 0
Attributes:
regrid_method: bilinear
In [5]: data_out.spatial_ref
Out[5]:
<xarray.DataArray 'spatial_ref' ()> Size: 8B
array(0)
Coordinates:
spatial_ref int64 8B 0
Attributes:
crs_wkt: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["...
semi_major_axis: 6378137.0
semi_minor_axis: 6356752.314245179
inverse_flattening: 298.257223563
reference_ellipsoid_name: WGS 84
longitude_of_prime_meridian: 0.0
prime_meridian_name: Greenwich
geographic_crs_name: WGS 84
horizontal_datum_name: World Geodetic System 1984
grid_mapping_name: latitude_longitude
spatial_ref: GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["...
In [6]: data_out_nztm = data_out.rio.reproject('EPGS:2193') [20/4699]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[6], line 1
----> 1 data_out_nztm = data_out.rio.reproject('EPGS:2193')
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/rioxarray/raster_array.py:468, in RasterArray.reproject(self, dst_crs, resolution, shape, transform, resampling,
nodata, **kwargs)
461 kwargs.setdefault("gcps", gcps)
463 use_affine = (
464 "gcps" not in kwargs
465 and "rpcs" not in kwargs
466 and "src_geoloc_array" not in kwargs
467 )
--> 468 src_affine = None if not use_affine else self.transform(recalc=True)
469 if transform is None:
470 dst_affine, dst_width, dst_height = _make_dst_affine(
471 src_data_array=self._obj,
472 src_crs=self.crs,
(...) 476 **kwargs,
477 )
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/rioxarray/rioxarray.py:707, in XRasterBase.transform(self, recalc)
704 return transform
706 try:
--> 707 src_left, _, _, src_top = self._unordered_bounds(recalc=recalc)
708 src_resolution_x, src_resolution_y = self.resolution(recalc=recalc)
709 except (DimensionMissingCoordinateError, DimensionError):
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/rioxarray/rioxarray.py:1079, in XRasterBase._unordered_bounds(self, recalc)
1062 def _unordered_bounds(
1063 self, recalc: bool = False
1064 ) -> tuple[float, float, float, float]:
1065 """
1066 Unordered bounds.
1067
(...) 1077 Outermost coordinates of the `xarray.DataArray` | `xarray.Dataset`.
1078 """
-> 1079 resolution_x, resolution_y = self.resolution(recalc=recalc)
1081 try:
1082 # attempt to get bounds from xarray coordinate values
1083 left, bottom, right, top = self._internal_bounds()
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/rioxarray/rioxarray.py:1046, in XRasterBase.resolution(self, recalc)
1043 # if the coordinates of the spatial dimensions are missing
1044 # use the cached transform resolution
1045 try:
-> 1046 left, bottom, right, top = self._internal_bounds()
1047 except DimensionMissingCoordinateError:
1048 if transform is None:
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/rioxarray/rioxarray.py:1009, in XRasterBase._internal_bounds(self)
1007 raise DimensionMissingCoordinateError(f"{self.y_dim} missing coordinates.")
1008 try:
-> 1009 left = float(self._obj[self.x_dim][0])
1010 right = float(self._obj[self.x_dim][-1])
1011 top = float(self._obj[self.y_dim][0])
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/xarray/core/common.py:157, in AbstractArray.__float__(self)
156 def __float__(self: Any) -> float:
--> 157 return float(self.values)
TypeError: only length-1 arrays can be converted to Python scalars
Problem description
The reprojection results in a TypeError exception.
Expected Output
I expected an xarray dataset in reprojected coordinates.
Environment Information
In [7]: rioxarray.show_versions()
rioxarray (0.18.2) deps:
rasterio: 1.4.3
xarray: 2025.1.2
GDAL: 3.10.2
GEOS: 3.13.0
PROJ: 9.5.1
PROJ DATA: /home/timh/mambaforge/envs/pyVPRM3/share/proj
GDAL DATA: /home/timh/mambaforge/envs/pyVPRM3/share/gdal
Other python deps:
scipy: 1.15.2
pyproj: 3.7.1
System:
python: 3.12.9 | packaged by conda-forge | (main, Mar 4 2025, 22:48:41) [GCC 13.3.0]
executable: /home/timh/mambaforge/envs/pyVPRM3/bin/python3.12
machine: Linux-4.18.0-553.8.1.el8_10.x86_64-x86_64-with-glibc2.28
Installation method
- installed by conda
Conda environment information (if you installed with conda):
conda list):
# packages in environment at /home/timh/mambaforge/envs/pyVPRM3:
#
# Name Version Build Channel
_libgcc_mutex 0.1 conda_forge conda-forge
_openmp_mutex 4.5 2_gnu conda-forge
affine 2.4.0 pyhd8ed1ab_1 conda-forge
aiobotocore 2.21.0 pyhd8ed1ab_0 conda-forge
aiohappyeyeballs 2.4.8 pyhd8ed1ab_0 conda-forge
aiohttp 3.11.13 py312h178313f_0 conda-forge
aioitertools 0.12.0 pyhd8ed1ab_1 conda-forge
aiosignal 1.3.2 pyhd8ed1ab_0 conda-forge
alabaster 1.0.0 pyhd8ed1ab_1 conda-forge
alsa-lib 1.2.13 hb9d3cd8_0 conda-forge
anyio 4.8.0 pyhd8ed1ab_0 conda-forge
aom 3.9.1 hac33072_0 conda-forge
archspec 0.2.5 pyhd8ed1ab_0 conda-forge
argon2-cffi 23.1.0 pyhd8ed1ab_1 conda-forge
argon2-cffi-bindings 21.2.0 py312h66e93f0_5 conda-forge
arrow 1.3.0 pyhd8ed1ab_1 conda-forge
astroid 3.3.8 py312h7900ff3_0 conda-forge
astropy 7.0.1 pyhd8ed1ab_0 conda-forge
astropy-base 7.0.1 py312hb8e8fe3_0 conda-forge
astropy-iers-data 0.2025.3.3.0.34.45 pyhd8ed1ab_0 conda-forge
asttokens 3.0.0 pyhd8ed1ab_1 conda-forge
async-lru 2.0.4 pyhd8ed1ab_1 conda-forge
attr 2.5.1 h166bdaf_1 conda-forge
attrs 25.1.0 pyh71513ae_0 conda-forge
aws-c-auth 0.8.1 h205f482_0 conda-forge
aws-c-cal 0.8.1 h1a47875_3 conda-forge
aws-c-common 0.10.6 hb9d3cd8_0 conda-forge
aws-c-compression 0.3.0 h4e1184b_5 conda-forge
aws-c-event-stream 0.5.0 h7959bf6_11 conda-forge
aws-c-http 0.9.2 hefd7a92_4 conda-forge
aws-c-io 0.15.3 h173a860_6 conda-forge
aws-c-mqtt 0.11.0 h11f4f37_12 conda-forge
aws-c-s3 0.7.9 he1b24dc_1 conda-forge
aws-c-sdkutils 0.2.2 h4e1184b_0 conda-forge
aws-checksums 0.2.2 h4e1184b_4 conda-forge
aws-crt-cpp 0.29.9 he0e7f3f_2 conda-forge
aws-sdk-cpp 1.11.489 h4d475cb_0 conda-forge
azure-core-cpp 1.14.0 h5cfcd09_0 conda-forge
azure-identity-cpp 1.10.0 h113e628_0 conda-forge
azure-storage-blobs-cpp 12.13.0 h3cf044e_1 conda-forge
azure-storage-common-cpp 12.8.0 h736e048_1 conda-forge
azure-storage-files-datalake-cpp 12.12.0 ha633028_1 conda-forge
babel 2.17.0 pyhd8ed1ab_0 conda-forge
beautifulsoup4 4.13.3 pyha770c72_0 conda-forge
black 25.1.0 py312h7900ff3_0 conda-forge
bleach 6.2.0 pyh29332c3_4 conda-forge
blosc 1.21.6 he440d0b_1 conda-forge
bokeh 3.6.3 pyhd8ed1ab_0 conda-forge
boltons 24.0.0 pyhd8ed1ab_1 conda-forge
botocore 1.37.1 pyge310_1234567_0 conda-forge
bottleneck 1.4.2 py312hc0a28a1_0 conda-forge
bqplot 0.12.43 pyhd8ed1ab_1 conda-forge
branca 0.8.1 pyhd8ed1ab_0 conda-forge
brotli 1.1.0 hb9d3cd8_2 conda-forge
brotli-bin 1.1.0 hb9d3cd8_2 conda-forge
brotli-python 1.1.0 py312h2ec8cdc_2 conda-forge
bzip2 1.0.8 h4bc722e_7 conda-forge
c-ares 1.34.4 hb9d3cd8_0 conda-forge
ca-certificates 2025.1.31 hbcca054_0 conda-forge
cached-property 1.5.2 hd8ed1ab_1 conda-forge
cached_property 1.5.2 pyha770c72_1 conda-forge
cachetools 5.5.2 pyhd8ed1ab_0 conda-forge
cairo 1.18.2 h3394656_1 conda-forge
cartopy 0.24.0 py312hf9745cd_0 conda-forge
certifi 2025.1.31 pyhd8ed1ab_0 conda-forge
cf_xarray 0.10.0 pyhd8ed1ab_2 conda-forge
cffi 1.17.1 py312h06ac9bb_0 conda-forge
cftime 1.6.4 py312hc0a28a1_1 conda-forge
chardet 5.2.0 py312h7900ff3_2 conda-forge
charset-normalizer 3.4.1 pyhd8ed1ab_0 conda-forge
click 8.1.8 pyh707e725_0 conda-forge
click-plugins 1.1.1 pyhd8ed1ab_1 conda-forge
cligj 0.7.2 pyhd8ed1ab_2 conda-forge
cloudpickle 3.1.1 pyhd8ed1ab_0 conda-forge
colorama 0.4.6 pyhd8ed1ab_1 conda-forge
colorcet 3.1.0 pyhd8ed1ab_1 conda-forge
comm 0.2.2 pyhd8ed1ab_1 conda-forge
conda 25.1.1 py312h7900ff3_1 conda-forge
conda-build 25.1.2 py312h7900ff3_3 conda-forge
conda-index 0.5.0 pyhd8ed1ab_0 conda-forge
conda-libmamba-solver 25.1.1 pyhd8ed1ab_0 conda-forge
conda-package-handling 2.4.0 pyh7900ff3_2 conda-forge
conda-package-streaming 0.11.0 pyhd8ed1ab_0 conda-forge
contourpy 1.3.1 py312h68727a3_0 conda-forge
cpp-expected 1.1.0 hf52228f_0 conda-forge
cycler 0.12.1 pyhd8ed1ab_1 conda-forge
cyrus-sasl 2.1.27 h54b06d7_7 conda-forge
cytoolz 1.0.1 py312h66e93f0_0 conda-forge
dask 2025.2.0 pyhd8ed1ab_0 conda-forge
dask-core 2025.2.0 pyhd8ed1ab_0 conda-forge
datashader 0.17.0 pyhd8ed1ab_0 conda-forge
dav1d 1.2.1 hd590300_0 conda-forge
dbus 1.13.6 h5008d03_3 conda-forge
debugpy 1.8.13 py312h2ec8cdc_0 conda-forge
decorator 5.2.1 pyhd8ed1ab_0 conda-forge
defusedxml 0.7.1 pyhd8ed1ab_0 conda-forge
dill 0.3.9 pyhd8ed1ab_1 conda-forge
distlib 0.3.9 pyhd8ed1ab_1 conda-forge
distributed 2025.2.0 pyhd8ed1ab_0 conda-forge
distro 1.9.0 pyhd8ed1ab_1 conda-forge
docutils 0.21.2 pyhd8ed1ab_1 conda-forge
double-conversion 3.3.1 h5888daf_0 conda-forge
eccodes 2.40.0 h8bb6dbc_0 conda-forge
entrypoints 0.4 pyhd8ed1ab_1 conda-forge
esmf 8.8.0 mpi_mpich_h7cf99a1_100 conda-forge
esmpy 8.8.0 pyhecae5ae_0 conda-forge
exceptiongroup 1.2.2 pyhd8ed1ab_1 conda-forge
executing 2.1.0 pyhd8ed1ab_1 conda-forge
expat 2.6.4 h5888daf_0 conda-forge
fancycompleter 0.9.1 py312h7900ff3_1007 conda-forge
filelock 3.17.0 pyhd8ed1ab_0 conda-forge
fiona 1.10.1 py312h02b19dd_3 conda-forge
fmt 11.0.2 h434a139_0 conda-forge
folium 0.19.5 pyhd8ed1ab_0 conda-forge
font-ttf-dejavu-sans-mono 2.37 hab24e00_0 conda-forge
font-ttf-inconsolata 3.000 h77eed37_0 conda-forge
font-ttf-source-code-pro 2.038 h77eed37_0 conda-forge
font-ttf-ubuntu 0.83 h77eed37_3 conda-forge
fontconfig 2.15.0 h7e30c49_1 conda-forge
fonts-conda-ecosystem 1 0 conda-forge
fonts-conda-forge 1 0 conda-forge
fonttools 4.56.0 py312h178313f_0 conda-forge
fqdn 1.5.1 pyhd8ed1ab_1 conda-forge
freeglut 3.2.2 ha6d2627_3 conda-forge
freetype 2.12.1 h267a509_2 conda-forge
freexl 2.0.0 h9dce30a_2 conda-forge
frozendict 2.4.6 py312h66e93f0_0 conda-forge
frozenlist 1.5.0 py312h178313f_1 conda-forge
fsspec 2025.2.0 pyhd8ed1ab_0 conda-forge
gast 0.4.0 pyh9f0ad1d_0 conda-forge
geopandas 1.0.1 pyhd8ed1ab_3 conda-forge
geopandas-base 1.0.1 pyha770c72_3 conda-forge
geos 3.13.0 h5888daf_0 conda-forge
geotiff 1.7.4 h3551947_0 conda-forge
geoviews 1.14.0 hd8ed1ab_0 conda-forge
geoviews-core 1.14.0 pyha770c72_0 conda-forge
gflags 2.2.2 h5888daf_1005 conda-forge
giflib 5.2.2 hd590300_0 conda-forge
gitdb 4.0.12 pyhd8ed1ab_0 conda-forge
gitpython 3.1.44 pyhff2d567_0 conda-forge
gitsummary 0.2 pyhd8ed1ab_0 conda-forge
glog 0.7.1 hbabe93e_0 conda-forge
graphite2 1.3.13 h59595ed_1003 conda-forge
h11 0.14.0 pyhd8ed1ab_1 conda-forge
h2 4.2.0 pyhd8ed1ab_0 conda-forge
h3-py 4.2.1 py312h2ec8cdc_1 conda-forge
h5py 3.13.0 nompi_py312hedeef09_100 conda-forge
harfbuzz 10.4.0 h76408a6_0 conda-forge
hdf4 4.2.15 h2a13503_7 conda-forge
hdf5 1.14.3 mpi_mpich_h7f58efa_9 conda-forge
holoviews 1.20.1 pyhd8ed1ab_0 conda-forge
hpack 4.1.0 pyhd8ed1ab_0 conda-forge
html5lib 1.1 pyhd8ed1ab_2 conda-forge
httpcore 1.0.7 pyh29332c3_1 conda-forge
httpx 0.28.1 pyhd8ed1ab_0 conda-forge
hvplot 0.11.2 pyhd8ed1ab_0 conda-forge
hyperframe 6.1.0 pyhd8ed1ab_0 conda-forge
icu 75.1 he02047a_0 conda-forge
idna 3.10 pyhd8ed1ab_1 conda-forge
imagesize 1.4.1 pyhd8ed1ab_0 conda-forge
importlib-metadata 8.6.1 pyha770c72_0 conda-forge
importlib_resources 6.5.2 pyhd8ed1ab_0 conda-forge
iniconfig 2.0.0 pyhd8ed1ab_1 conda-forge
ipdb 0.13.13 pyhd8ed1ab_1 conda-forge
ipydatagrid 1.4.0 pyhd8ed1ab_1 conda-forge
ipykernel 6.29.5 pyh3099207_0 conda-forge
ipython 9.0.0 pyhfb0248b_1 conda-forge
ipython_pygments_lexers 1.1.1 pyhd8ed1ab_0 conda-forge
ipywidgets 8.1.5 pyhd8ed1ab_1 conda-forge
isoduration 20.11.0 pyhd8ed1ab_1 conda-forge
isort 6.0.1 pyhd8ed1ab_0 conda-forge
jasper 4.2.4 h536e39c_0 conda-forge
jedi 0.19.2 pyhd8ed1ab_1 conda-forge
jinja2 3.1.5 pyhd8ed1ab_0 conda-forge
jmespath 1.0.1 pyhd8ed1ab_1 conda-forge
joblib 1.4.2 pyhd8ed1ab_1 conda-forge
jplephem 2.21 pyh9b8db34_1 conda-forge
json-c 0.18 h6688a6e_0 conda-forge
json5 0.10.0 pyhd8ed1ab_1 conda-forge
jsonpatch 1.33 pyhd8ed1ab_1 conda-forge
jsonpointer 3.0.0 py312h7900ff3_1 conda-forge
jsonschema 4.23.0 pyhd8ed1ab_1 conda-forge
jsonschema-specifications 2024.10.1 pyhd8ed1ab_1 conda-forge
jsonschema-with-format-nongpl 4.23.0 hd8ed1ab_1 conda-forge
jupyter-lsp 2.2.5 pyhd8ed1ab_1 conda-forge
jupyter_client 8.6.3 pyhd8ed1ab_1 conda-forge
jupyter_console 6.6.3 pyhd8ed1ab_1 conda-forge
jupyter_core 5.7.2 pyh31011fe_1 conda-forge
jupyter_events 0.12.0 pyh29332c3_0 conda-forge
jupyter_server 2.15.0 pyhd8ed1ab_0 conda-forge
jupyter_server_terminals 0.5.3 pyhd8ed1ab_1 conda-forge
jupyterlab 4.3.5 pyhd8ed1ab_0 conda-forge
jupyterlab_code_formatter 3.0.2 pyhd8ed1ab_1 conda-forge
jupyterlab_pygments 0.3.0 pyhd8ed1ab_2 conda-forge
jupyterlab_server 2.27.3 pyhd8ed1ab_1 conda-forge
jupyterlab_widgets 3.0.13 pyhd8ed1ab_1 conda-forge
keyutils 1.6.1 h166bdaf_0 conda-forge
kiwisolver 1.4.8 py312h84d6215_0 conda-forge
krb5 1.21.3 h659f571_0 conda-forge
lcms2 2.17 h717163a_0 conda-forge
ld_impl_linux-64 2.43 h712a8e2_4 conda-forge
lerc 4.0.0 h27087fc_0 conda-forge
libabseil 20240722.0 cxx17_hbbce691_4 conda-forge
libaec 1.1.3 h59595ed_0 conda-forge
libarchive 3.7.7 h4585015_3 conda-forge
libarrow 19.0.1 hfa2a6e7_0_cpu conda-forge
libarrow-acero 19.0.1 hcb10f89_0_cpu conda-forge
libarrow-dataset 19.0.1 hcb10f89_0_cpu conda-forge
libarrow-substrait 19.0.1 h08228c5_0_cpu conda-forge
libavif16 1.2.0 hf3231e4_0 conda-forge
libblas 3.9.0 31_h59b9bed_openblas conda-forge
libbrotlicommon 1.1.0 hb9d3cd8_2 conda-forge
libbrotlidec 1.1.0 hb9d3cd8_2 conda-forge
libbrotlienc 1.1.0 hb9d3cd8_2 conda-forge
libcap 2.71 h39aace5_0 conda-forge
libcblas 3.9.0 31_he106b2a_openblas conda-forge
libclang-cpp19.1 19.1.7 default_hb5137d0_1 conda-forge
libclang13 19.1.7 default_h9c6a7e4_1 conda-forge
libcrc32c 1.1.2 h9c3ff4c_0 conda-forge
libcups 2.3.3 h4637d8d_4 conda-forge
libcurl 8.12.1 h332b0f4_0 conda-forge
libde265 1.0.15 h00ab1b0_0 conda-forge
libdeflate 1.23 h4ddbbb0_0 conda-forge
libdrm 2.4.124 hb9d3cd8_0 conda-forge
libedit 3.1.20250104 pl5321h7949ede_0 conda-forge
libegl 1.7.0 ha4b6fd6_2 conda-forge
libev 4.33 hd590300_2 conda-forge
libevent 2.1.12 hf998b51_1 conda-forge
libexpat 2.6.4 h5888daf_0 conda-forge
libfabric 2.0.0 ha770c72_1 conda-forge
libfabric1 2.0.0 h14e6f36_1 conda-forge
libffi 3.4.6 h2dba641_0 conda-forge
libgcc 14.2.0 h767d61c_2 conda-forge
libgcc-ng 14.2.0 h69a702a_2 conda-forge
libgcrypt-lib 1.11.0 hb9d3cd8_2 conda-forge
libgdal-core 3.10.2 h3359108_0 conda-forge
libgfortran 14.2.0 h69a702a_2 conda-forge
libgfortran-ng 14.2.0 h69a702a_2 conda-forge
libgfortran5 14.2.0 hf1ad2bd_2 conda-forge
libgl 1.7.0 ha4b6fd6_2 conda-forge
libglib 2.82.2 h2ff4ddf_1 conda-forge
libglu 9.0.3 h03adeef_0 conda-forge
libglvnd 1.7.0 ha4b6fd6_2 conda-forge
libglx 1.7.0 ha4b6fd6_2 conda-forge
libgomp 14.2.0 h767d61c_2 conda-forge
libgoogle-cloud 2.35.0 h2b5623c_0 conda-forge
libgoogle-cloud-storage 2.35.0 h0121fbd_0 conda-forge
libgpg-error 1.51 hbd13f7d_1 conda-forge
libgrpc 1.67.1 h25350d4_2 conda-forge
libheif 1.19.6 gpl_hc18d805_100 conda-forge
libhwloc 2.11.2 default_h0d58e46_1001 conda-forge
libiconv 1.18 h4ce23a2_1 conda-forge
libjpeg-turbo 3.0.0 hd590300_1 conda-forge
libkml 1.3.0 hf539b9f_1021 conda-forge
liblapack 3.9.0 31_h7ac8fdf_openblas conda-forge
liblief 0.14.1 h5888daf_2 conda-forge
libllvm15 15.0.7 ha7bfdaf_5 conda-forge
libllvm19 19.1.7 ha7bfdaf_1 conda-forge
liblzma 5.6.4 hb9d3cd8_0 conda-forge
libmamba 2.0.5 h49b8a8d_1 conda-forge
libmambapy 2.0.5 py312hbaee817_1 conda-forge
libnetcdf 4.9.2 mpi_mpich_h761946e_14 conda-forge
libnghttp2 1.64.0 h161d5f1_0 conda-forge
libnl 3.11.0 hb9d3cd8_0 conda-forge
libnsl 2.0.1 hd590300_0 conda-forge
libntlm 1.8 hb9d3cd8_0 conda-forge
libopenblas 0.3.29 pthreads_h94d23a6_0 conda-forge
libopengl 1.7.0 ha4b6fd6_2 conda-forge
libopentelemetry-cpp 1.18.0 hfcad708_1 conda-forge
libopentelemetry-cpp-headers 1.18.0 ha770c72_1 conda-forge
libparquet 19.0.1 h081d1f1_0_cpu conda-forge
libpciaccess 0.18 hd590300_0 conda-forge
libpnetcdf 1.13.0 mpi_mpich_hdce4f7b_101 conda-forge
libpng 1.6.47 h943b412_0 conda-forge
libpq 17.4 h27ae623_0 conda-forge
libprotobuf 5.28.3 h6128344_1 conda-forge
libre2-11 2024.07.02 hbbce691_2 conda-forge
librttopo 1.1.0 h97f6797_17 conda-forge
libsodium 1.0.20 h4ab18f5_0 conda-forge
libsolv 0.7.30 h3509ff9_0 conda-forge
libspatialite 5.1.0 h1b4f908_12 conda-forge
libsqlite 3.49.1 hee588c1_1 conda-forge
libssh2 1.11.1 hf672d98_0 conda-forge
libstdcxx 14.2.0 h8f9b012_2 conda-forge
libstdcxx-ng 14.2.0 h4852527_2 conda-forge
libsystemd0 257.3 h3dc2cb9_0 conda-forge
libthrift 0.21.0 h0e7cc3e_0 conda-forge
libtiff 4.7.0 hd9ff511_3 conda-forge
libudev1 257.3 h9a4d06a_0 conda-forge
libutf8proc 2.10.0 h4c51ac1_0 conda-forge
libuuid 2.38.1 h0b41bf4_0 conda-forge
libuv 1.50.0 hb9d3cd8_0 conda-forge
libwebp-base 1.5.0 h851e524_0 conda-forge
libxcb 1.17.0 h8a09558_0 conda-forge
libxcrypt 4.4.36 hd590300_1 conda-forge
libxkbcommon 1.8.0 hc4a0caf_0 conda-forge
libxml2 2.13.6 h8d12d68_0 conda-forge
libxslt 1.1.39 h76b75d6_0 conda-forge
libzip 1.11.2 h6991a6a_0 conda-forge
libzlib 1.3.1 hb9d3cd8_2 conda-forge
linkify-it-py 2.0.3 pyhd8ed1ab_1 conda-forge
llvmlite 0.44.0 py312h374181b_0 conda-forge
locket 1.0.0 pyhd8ed1ab_0 conda-forge
loguru 0.7.2 py312h7900ff3_2 conda-forge
lxml 5.3.1 py312he28fd5a_0 conda-forge
lz4 4.3.3 py312hf0f0c11_2 conda-forge
lz4-c 1.10.0 h5888daf_1 conda-forge
lzo 2.10 hd590300_1001 conda-forge
m2r2 0.3.3.post2 pyhd8ed1ab_1 conda-forge
mapclassify 2.8.1 pyhd8ed1ab_1 conda-forge
markdown 3.6 pyhd8ed1ab_0 conda-forge
markdown-it-py 3.0.0 pyhd8ed1ab_1 conda-forge
markupsafe 3.0.2 py312h178313f_1 conda-forge
matplotlib 3.10.1 py312h7900ff3_0 conda-forge
matplotlib-base 3.10.1 py312hd3ec401_0 conda-forge
matplotlib-inline 0.1.7 pyhd8ed1ab_1 conda-forge
mccabe 0.7.0 pyhd8ed1ab_1 conda-forge
mdit-py-plugins 0.4.2 pyhd8ed1ab_1 conda-forge
mdurl 0.1.2 pyhd8ed1ab_1 conda-forge
menuinst 2.2.0 py312h7900ff3_0 conda-forge
minizip 4.0.7 h05a5f5f_3 conda-forge
mistune 0.8.4 pyh1a96a4e_1006 conda-forge
more-itertools 10.6.0 pyhd8ed1ab_0 conda-forge
mpi 1.0.1 mpich conda-forge
mpich 4.3.0 h1a8bee6_100 conda-forge
mpmath 1.3.0 pyhd8ed1ab_1 conda-forge
msgpack-python 1.1.0 py312h68727a3_0 conda-forge
multidict 6.1.0 py312h178313f_2 conda-forge
multipledispatch 0.6.0 pyhd8ed1ab_1 conda-forge
munkres 1.1.4 pyh9f0ad1d_0 conda-forge
mypy 1.15.0 py312h66e93f0_0 conda-forge
mypy_extensions 1.0.0 pyha770c72_1 conda-forge
mysql-common 9.0.1 h266115a_4 conda-forge
mysql-libs 9.0.1 he0572af_4 conda-forge
nbclient 0.10.2 pyhd8ed1ab_0 conda-forge
nbconvert-core 6.5.3 pyhd8ed1ab_0 conda-forge
nbformat 5.10.4 pyhd8ed1ab_1 conda-forge
ncurses 6.5 h2d0b736_3 conda-forge
nest-asyncio 1.6.0 pyhd8ed1ab_1 conda-forge
netcdf-fortran 4.6.1 mpi_mpich_h2e543cf_8 conda-forge
netcdf4 1.7.2 nompi_py312h21d6d8e_101 conda-forge
networkx 3.4.2 pyh267e887_2 conda-forge
nlohmann_json 3.11.3 he02047a_1 conda-forge
nodeenv 1.9.1 pyhd8ed1ab_1 conda-forge
nodejs 22.12.0 hf235a45_0 conda-forge
notebook-shim 0.2.4 pyhd8ed1ab_1 conda-forge
numba 0.61.0 py312h2e6246c_1 conda-forge
numpy 2.1.3 py312h58c1407_0 conda-forge
nzgeom 0.1.6 pyhd8ed1ab_0 conda-forge
openjpeg 2.5.3 h5fbd93e_0 conda-forge
openldap 2.6.9 he970967_0 conda-forge
openssl 3.4.1 h7b32b05_0 conda-forge
orc 2.0.3 h12ee42a_2 conda-forge
overrides 7.7.0 pyhd8ed1ab_1 conda-forge
packaging 24.2 pyhd8ed1ab_2 conda-forge
pandas 2.2.3 py312hf9745cd_1 conda-forge
pandocfilters 1.5.0 pyhd8ed1ab_0 conda-forge
panel 1.6.1 pyhd8ed1ab_0 conda-forge
parallelio 2.6.3 mpi_mpich_h43d51f9_100 conda-forge
param 2.2.0 pyhd8ed1ab_0 conda-forge
parso 0.8.4 pyhd8ed1ab_1 conda-forge
partd 1.4.2 pyhd8ed1ab_0 conda-forge
patch 2.7.6 h7f98852_1002 conda-forge
patchelf 0.17.2 h58526e2_0 conda-forge
pathspec 0.12.1 pyhd8ed1ab_1 conda-forge
patsy 1.0.1 pyhd8ed1ab_1 conda-forge
pcre2 10.44 hba22ea6_2 conda-forge
pdbpp 0.10.3 pyhd8ed1ab_1 conda-forge
pexpect 4.9.0 pyhd8ed1ab_1 conda-forge
pickleshare 0.7.5 pyhd8ed1ab_1004 conda-forge
pillow 11.1.0 py312h80c1187_0 conda-forge
pip 25.0.1 pyh8b19718_0 conda-forge
pixman 0.44.2 h29eaf8c_0 conda-forge
pkginfo 1.12.1.2 pyhd8ed1ab_0 conda-forge
pkgutil-resolve-name 1.3.10 pyhd8ed1ab_2 conda-forge
platformdirs 4.3.6 pyhd8ed1ab_1 conda-forge
pluggy 1.5.0 pyhd8ed1ab_1 conda-forge
proj 9.5.1 h0054346_0 conda-forge
prometheus-cpp 1.3.0 ha5d0236_0 conda-forge
prometheus_client 0.21.1 pyhd8ed1ab_0 conda-forge
prompt-toolkit 3.0.50 pyha770c72_0 conda-forge
prompt_toolkit 3.0.50 hd8ed1ab_0 conda-forge
propcache 0.2.1 py312h178313f_1 conda-forge
psutil 7.0.0 py312h66e93f0_0 conda-forge
pthread-stubs 0.4 hb9d3cd8_1002 conda-forge
ptyprocess 0.7.0 pyhd8ed1ab_1 conda-forge
pure_eval 0.2.3 pyhd8ed1ab_1 conda-forge
py-lief 0.14.1 py312h2ec8cdc_2 conda-forge
py2vega 0.6.1 pyhd8ed1ab_0 conda-forge
pyarrow 19.0.1 py312h7900ff3_0 conda-forge
pyarrow-core 19.0.1 py312h01725c0_0_cpu conda-forge
pybind11-abi 4 hd8ed1ab_3 conda-forge
pycosat 0.6.6 py312h66e93f0_2 conda-forge
pycparser 2.22 pyh29332c3_1 conda-forge
pyct 0.5.0 pyhd8ed1ab_1 conda-forge
pyerfa 2.0.1.5 py312hc0a28a1_0 conda-forge
pygments 2.19.1 pyhd8ed1ab_0 conda-forge
pygrib 2.1.6 py312he631bd4_1 conda-forge
pylint 3.3.4 pyh29332c3_0 conda-forge
pyogrio 0.10.0 py312h02b19dd_1 conda-forge
pyparsing 3.2.1 pyhd8ed1ab_0 conda-forge
pyproj 3.7.1 py312he630544_0 conda-forge
pyproject-api 1.9.0 pyh29332c3_0 conda-forge
pyrepl 0.9.0 py312h66e93f0_10 conda-forge
pyright 1.1.396 py312h66e93f0_0 conda-forge
pyshp 2.3.1 pyhd8ed1ab_1 conda-forge
pyside6 6.8.2 py312h91f0f75_1 conda-forge
pysocks 1.7.1 pyha55dd90_7 conda-forge
pytest 8.3.5 pyhd8ed1ab_0 conda-forge
python 3.12.9 h9e4cc4f_1_cpython conda-forge
python-dateutil 2.9.0.post0 pyhff2d567_1 conda-forge
python-fastjsonschema 2.21.1 pyhd8ed1ab_0 conda-forge
python-json-logger 2.0.7 pyhd8ed1ab_0 conda-forge
python-libarchive-c 5.1 py312h7900ff3_1 conda-forge
python-tzdata 2025.1 pyhd8ed1ab_0 conda-forge
python_abi 3.12 5_cp312 conda-forge
pytz 2024.1 pyhd8ed1ab_0 conda-forge
pyviz_comms 3.0.4 pyhd8ed1ab_1 conda-forge
pyvprm 3.0 dev_0 <develop>
pyyaml 6.0.2 py312h178313f_2 conda-forge
pyzmq 26.2.1 py312hbf22597_0 conda-forge
qhull 2020.2 h434a139_5 conda-forge
qt6-main 6.8.2 h588cce1_0 conda-forge
rasterio 1.4.3 py312h8cae83d_0 conda-forge
rav1e 0.6.6 he8a937b_2 conda-forge
rdma-core 56.0 h5888daf_0 conda-forge
re2 2024.07.02 h9925aae_2 conda-forge
readline 8.2 h8c095d6_2 conda-forge
referencing 0.36.2 pyh29332c3_0 conda-forge
reproc 14.2.5.post0 hb9d3cd8_0 conda-forge
reproc-cpp 14.2.5.post0 h5888daf_0 conda-forge
requests 2.32.3 pyhd8ed1ab_1 conda-forge
rfc3339-validator 0.1.4 pyhd8ed1ab_1 conda-forge
rfc3986-validator 0.1.1 pyh9f0ad1d_0 conda-forge
rioxarray 0.18.2 pyhd8ed1ab_0 conda-forge
ripgrep 14.1.1 h8fae777_0 conda-forge
roman-numerals-py 3.1.0 pyhd8ed1ab_0 conda-forge
rpds-py 0.23.1 py312h3b7be25_0 conda-forge
ruamel.yaml 0.18.10 py312h66e93f0_0 conda-forge
ruamel.yaml.clib 0.2.8 py312h66e93f0_1 conda-forge
s2n 1.5.11 h072c03f_0 conda-forge
s3fs 2025.2.0 pyhd8ed1ab_0 conda-forge
scikit-learn 1.6.1 py312h7a48858_0 conda-forge
scipy 1.15.2 py312ha707e6e_0 conda-forge
send2trash 1.8.3 pyh0d859eb_1 conda-forge
setuptools 75.8.2 pyhff2d567_0 conda-forge
shapely 2.0.7 py312h391bc85_0 conda-forge
simdjson 3.11.6 h84d6215_0 conda-forge
six 1.17.0 pyhd8ed1ab_0 conda-forge
smmap 5.0.2 pyhd8ed1ab_0 conda-forge
snappy 1.2.1 h8bd8927_1 conda-forge
sniffio 1.3.1 pyhd8ed1ab_1 conda-forge
snowballstemmer 2.2.0 pyhd8ed1ab_0 conda-forge
snuggs 1.4.7 pyhd8ed1ab_2 conda-forge
sortedcontainers 2.4.0 pyhd8ed1ab_1 conda-forge
soupsieve 2.5 pyhd8ed1ab_1 conda-forge
sparse 0.15.5 pyh72ffeb9_0 conda-forge
spdlog 1.15.1 hb29a8c4_0 conda-forge
sphinx 8.2.3 pyhd8ed1ab_0 conda-forge
sphinx-autodoc-typehints 3.1.0 pyhd8ed1ab_0 conda-forge
sphinx_rtd_theme 3.0.1 pyha770c72_0 conda-forge
sphinxcontrib-applehelp 2.0.0 pyhd8ed1ab_1 conda-forge
sphinxcontrib-devhelp 2.0.0 pyhd8ed1ab_1 conda-forge
sphinxcontrib-htmlhelp 2.1.0 pyhd8ed1ab_1 conda-forge
sphinxcontrib-jquery 4.1 pyhd8ed1ab_1 conda-forge
sphinxcontrib-jsmath 1.0.1 pyhd8ed1ab_1 conda-forge
sphinxcontrib-qthelp 2.0.0 pyhd8ed1ab_1 conda-forge
sphinxcontrib-serializinghtml 1.1.10 pyhd8ed1ab_1 conda-forge
sqlite 3.49.1 h9eae976_1 conda-forge
stack_data 0.6.3 pyhd8ed1ab_1 conda-forge
statsmodels 0.14.4 py312hc0a28a1_0 conda-forge
svt-av1 3.0.0 h5888daf_0 conda-forge
tblib 3.0.0 pyhd8ed1ab_1 conda-forge
terminado 0.18.1 pyh0d859eb_0 conda-forge
threadpoolctl 3.5.0 pyhc1e730c_0 conda-forge
timezonefinder 6.5.8 py312h66e93f0_0 conda-forge
tinycss2 1.4.0 pyhd8ed1ab_0 conda-forge
tk 8.6.13 noxft_h4845f30_101 conda-forge
toml 0.10.2 pyhd8ed1ab_1 conda-forge
tomli 2.2.1 pyhd8ed1ab_1 conda-forge
tomlkit 0.13.2 pyha770c72_1 conda-forge
toolz 1.0.0 pyhd8ed1ab_1 conda-forge
tornado 6.4.2 py312h66e93f0_0 conda-forge
tox 4.24.1 pyh29332c3_0 conda-forge
tqdm 4.67.1 pyhd8ed1ab_1 conda-forge
traitlets 5.14.3 pyhd8ed1ab_1 conda-forge
traittypes 0.2.1 pyh9f0ad1d_2 conda-forge
truststore 0.10.1 pyh29332c3_0 conda-forge
types-python-dateutil 2.9.0.20241206 pyhd8ed1ab_0 conda-forge
typing-extensions 4.12.2 hd8ed1ab_1 conda-forge
typing_extensions 4.12.2 pyha770c72_1 conda-forge
typing_utils 0.1.0 pyhd8ed1ab_1 conda-forge
tzdata 2025a h78e105d_0 conda-forge
tzwhere 3.0.3 pyhd8ed1ab_0 conda-forge
uc-micro-py 1.0.3 pyhd8ed1ab_1 conda-forge
ucx 1.18.0 hfd9a62f_1 conda-forge
unicodedata2 16.0.0 py312h66e93f0_0 conda-forge
uri-template 1.3.0 pyhd8ed1ab_1 conda-forge
uriparser 0.9.8 hac33072_0 conda-forge
urllib3 2.3.0 pyhd8ed1ab_0 conda-forge
uuid 1.30 pypi_0 pypi
virtualenv 20.29.2 pyhd8ed1ab_0 conda-forge
wayland 1.23.1 h3e06ad9_0 conda-forge
wcwidth 0.2.13 pyhd8ed1ab_1 conda-forge
webcolors 24.11.1 pyhd8ed1ab_0 conda-forge
webencodings 0.5.1 pyhd8ed1ab_3 conda-forge
websocket-client 1.8.0 pyhd8ed1ab_1 conda-forge
wheel 0.45.1 pyhd8ed1ab_1 conda-forge
widgetsnbextension 4.0.13 pyhd8ed1ab_1 conda-forge
wmctrl 0.5 pyh707e725_2 conda-forge
wmctrl-cli 1.07 h1357fb4_3 conda-forge
wrapt 1.17.2 py312h66e93f0_0 conda-forge
x265 3.5 h924138e_3 conda-forge
xarray 2025.1.2 pyhd8ed1ab_0 conda-forge
xcb-util 0.4.1 hb711507_2 conda-forge
xcb-util-cursor 0.1.5 hb9d3cd8_0 conda-forge
xcb-util-image 0.4.0 hb711507_2 conda-forge
xcb-util-keysyms 0.4.1 hb711507_0 conda-forge
xcb-util-renderutil 0.3.10 hb711507_0 conda-forge
xcb-util-wm 0.4.2 hb711507_0 conda-forge
xerces-c 3.2.5 h988505b_2 conda-forge
xesmf 0.8.8 pyhd8ed1ab_1 conda-forge
xkeyboard-config 2.43 hb9d3cd8_0 conda-forge
xorg-libice 1.1.2 hb9d3cd8_0 conda-forge
xorg-libsm 1.2.5 he73a12e_0 conda-forge
xorg-libx11 1.8.11 h4f16b4b_0 conda-forge
xorg-libxau 1.0.12 hb9d3cd8_0 conda-forge
xorg-libxcomposite 0.4.6 hb9d3cd8_2 conda-forge
xorg-libxcursor 1.2.3 hb9d3cd8_0 conda-forge
xorg-libxdamage 1.1.6 hb9d3cd8_0 conda-forge
xorg-libxdmcp 1.1.5 hb9d3cd8_0 conda-forge
xorg-libxext 1.3.6 hb9d3cd8_0 conda-forge
xorg-libxfixes 6.0.1 hb9d3cd8_0 conda-forge
xorg-libxi 1.8.2 hb9d3cd8_0 conda-forge
xorg-libxmu 1.2.1 hb9d3cd8_1 conda-forge
xorg-libxrandr 1.5.4 hb9d3cd8_0 conda-forge
xorg-libxrender 0.9.12 hb9d3cd8_0 conda-forge
xorg-libxt 1.3.1 hb9d3cd8_0 conda-forge
xorg-libxtst 1.2.5 hb9d3cd8_3 conda-forge
xorg-libxxf86vm 1.1.6 hb9d3cd8_0 conda-forge
xyzservices 2025.1.0 pyhd8ed1ab_0 conda-forge
yaml 0.2.5 h7f98852_2 conda-forge
yaml-cpp 0.8.0 h59595ed_0 conda-forge
yarl 1.18.3 py312h178313f_1 conda-forge
zeromq 4.3.5 h3b0a872_7 conda-forge
zict 3.0.0 pyhd8ed1ab_1 conda-forge
zipp 3.21.0 pyhd8ed1ab_1 conda-forge
zlib 1.3.1 hb9d3cd8_2 conda-forge
zstandard 0.23.0 py312hef9b889_1 conda-forge
zstd 1.5.6 ha6fb4c9_0 conda-forge
$ conda list | grep -E "rasterio|xarray|gdal"
cf_xarray 0.10.0 pyhd8ed1ab_2 conda-forge
libgdal-core 3.10.2 h3359108_0 conda-forge
rasterio 1.4.3 py312h8cae83d_0 conda-forge
rioxarray 0.18.2 pyhd8ed1ab_0 conda-forge
xarray 2025.1.2 pyhd8ed1ab_0 conda-forge
Details about
conda and system ( conda info ):
$ conda info
active environment : pyVPRM3
active env location : /home/timh/mambaforge/envs/pyVPRM3
shell level : 2
user config file : /home/timh/.condarc
populated config files : /home/timh/mambaforge/.condarc
conda version : 24.9.0
conda-build version : 24.5.1
python version : 3.9.16.final.0
solver : libmamba (default)
virtual packages : __archspec=1=cascadelake
__conda=24.9.0=0
__glibc=2.28=0
__linux=4.18.0=0
__unix=0=0
base environment : /home/timh/mambaforge (writable)
conda av data dir : /home/timh/mambaforge/etc/conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/linux-64
https://conda.anaconda.org/conda-forge/noarch
package cache : /home/timh/mambaforge/pkgs
/home/timh/.conda/pkgs
envs directories : /home/timh/mambaforge/envs
/home/timh/.conda/envs
platform : linux-64
user-agent : conda/24.9.0 requests/2.31.0 CPython/3.9.16 Linux/4.18.0-553.8.1.el8_10.x86_64 rhel/8.10 glibc/2.28 solver/libmamba conda-libmamba-solver/23.11.1 libmambapy/1.5.8
UID:GID : 3678:3678
netrc file : None
offline mode : False
This happens with any ERA data?
This happens with any ERA data?
@RichardScottOZ, I don't know, honestly, I've only tried with the ERA5 data I am trying to use. I've regridded to a higher resolution in a previous step as well using xesmf. I suspect the problem is something to do with the structure of or metadata in the xarray dataset that xesmf produces, but 1) I don't know that for sure and 2) I'm a bit at a loss for what the problem might be.
Another possibility is the 180th meridian is messing something up. I'm working in New Zealand, and ERA5 and MODIS are tiled such that the datasets usually span the 180th meridian. That discontinuity in longitude has thrown unexpected wrenches into the gears with other tools.
I'm happy to post a netcdf file of the data I'm trying to reproject if that is helpful.
Looks like you have location array based data, x/y coords are 2d, but code that raises the error expects to see 1d x/y coords.
Does this work:
xds_1d = xds.rio.reproject(
"EPSG:2193",
src_geoloc_array=(
xds.coords["x"].values,
xds.coords["y"].values,
),
georeferencing_convention="PIXEL_CENTER",
)
Looks like you have location array based data, x/y coords are 2d, but code that raises the error expects to see 1d x/y coords.
That's true, yes... This particular dataset cannot be described with 1-dimensional X and Y coordinates (in its current projection, at least).
Does this work:
xds_1d = xds.rio.reproject( "EPSG:2193", src_geoloc_array=( xds.coords["x"].values, xds.coords["y"].values, ),
georeferencing_convention="PIXEL_CENTER", )
@snowman2 it does not, unfortunately... It tries to allocate a 300+ TB array and then fails with a memory error :(
In [25]: data_out
Out[25]:
<xarray.DataArray (time: 2, y: 2400, x: 2400)> Size: 92MB
array([[[ 0. , 0. , 0. , ...,
<... snip ...>
0. , 0. , 0. ]]])
Coordinates:
* time (time) datetime64[ns] 16B 2022-01-01 2022-01-01T01:00:00
x (y, x) float64 46MB 150.1 150.1 150.1 ... -177.3 -177.3 -177.3
y (y, x) float64 46MB -30.0 -30.0 -30.0 ... -40.0 -40.0 -40.0
spatial_ref int64 8B 0
Attributes:
regrid_method: bilinear
In [26]: xds_1d = data_out.rio.reproject(
...: "EPSG:2193",
...: src_geoloc_array=(
...: data_out.coords["x"].values,
...: data_out.coords["y"].values,
...: ),
...: georeferencing_convention="PIXEL_CENTER",
...: )
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
Cell In[26], line 1
----> 1 xds_1d = data_out.rio.reproject(
2 "EPSG:2193",
3 src_geoloc_array=(
4 data_out.coords["x"].values,
5 data_out.coords["y"].values,
6 ),
7 georeferencing_convention="PIXEL_CENTER",
8 )
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/rioxarray/raster_array.py:485, in RasterArray.reproject(self, dst_crs, resolution, shape, transform, resampling, nodata, **kwargs)
482 else:
483 dst_height, dst_width = self.shape
--> 485 dst_data = self._create_dst_data(dst_height=dst_height, dst_width=dst_width)
487 dst_nodata = self._get_dst_nodata(nodata)
488 rasterio.warp.reproject(
489 source=self._obj.values,
490 destination=dst_data,
(...) 498 **kwargs,
499 )
File ~/mambaforge/envs/pyVPRM3/lib/python3.12/site-packages/rioxarray/raster_array.py:542, in RasterArray._create_dst_data(self, dst_height, dst_width)
540 extra_dim = self._check_dimensions()
541 if extra_dim:
--> 542 dst_data = numpy.zeros(
543 (self._obj[extra_dim].size, dst_height, dst_width),
544 dtype=self._obj.dtype.type,
545 )
546 else:
547 dst_data = numpy.zeros((dst_height, dst_width), dtype=self._obj.dtype.type)
MemoryError: Unable to allocate 317. TiB for an array with shape (2, 2795031, 7800467) and data type float64
My sense from the documentation is that this array is within the intended use cases (that is, an xarray dataset with 2-dimensional X and Y grid locations roughly 2000 rows and columns. Is that accurate?
@Timothy-W-Hilton looks like this code can't auto-guess reasonable destination geobox:
https://github.com/corteva/rioxarray/blob/564c946d07058b8ebdc86b1751ba24169cd6c6ef/rioxarray/raster_array.py#L154-L160
you can specify destination raster geo referencing fully with transform=,shape=,dst_crs=, or you can play around with resolution= parameter and see if that fixes anything, although it's probably due to lon=180 crossing.
This is likely a helpful reference: https://github.com/corteva/rioxarray/issues/58