corteva / rioxarray

geospatial xarray extension powered by rasterio
https://corteva.github.io/rioxarray
Other
504 stars 80 forks source link

rioxarray.open_rasterio() and xr.open_dataset() return different affine transforms #681

Closed rbavery closed 12 months ago

rbavery commented 1 year ago

Code Sample, a copy-pastable example if possible

import rioxarray
import xarray as XR
url = "https://dap.ceda.ac.uk/neodc/esacci/land_surface_temperature/data/MULTISENSOR_IRCDR/L3S/0.01/v2.00/monthly/2020/11/ESACCI-LST-L3S-LST-IRCDR_-0.01deg_1MONTHLY_DAY-20201101000000-fv2.00.nc#mode=bytes"
xr_ds = xr.open_dataset(url, mask_and_scale=True)
xr_ds
print(xr_ds.rio.transform())
rio_ds = rioxarray.open_rasterio(url, mask_and_scale=True)
print(rio_ds.rio.transform())

Problem description

I'm trying to open an LST dataset in NetCDF that has a WGS84 projection. When I read the dataset with Xarray vs when I read with rioxarray, I get different affine transforms and I'm not sure why.

With the xr.open_dataset method, I get

Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, 0.009999999457435136, -90.00000274631076)

this is not quite correct, signs are flipped for the last two values I think

https://gis.stackexchange.com/questions/414127/valueerror-negative-dimensions-are-not-allowed-when-using-raster-created-from

with rioxarray I get

Affine(1.0, 0.0, 0.0,
       0.0, 1.0, 0.0)

Expected Output

I'd expect the geotransform to be read correctly and for both methods to return the same geotransform. Maybe this is a dataset limitation, but I would expect the transforms to be the same when accessing the transform with the rio accessor.

Environment Information

rioxarray (0.14.1) deps:
  rasterio: 1.3.8
    xarray: 2023.6.0
      GDAL: 3.7.0
      GEOS: 3.11.2
      PROJ: 9.2.1
 PROJ DATA: /Users/ryanavery/mambaforge/envs/geo-ds-cholera/share/proj
 GDAL DATA: /Users/ryanavery/mambaforge/envs/geo-ds-cholera/share/gdal

Other python deps:
     scipy: 1.11.1
    pyproj: 3.6.0

System:
    python: 3.11.3 | packaged by conda-forge | (main, Apr  6 2023, 08:58:31) [Clang 14.0.6 ]
executable: /Users/ryanavery/mambaforge/envs/geo-ds-cholera/bin/python
   machine: macOS-13.0.1-arm64-arm-64bit

Installation method

Conda environment information (if you installed with conda):

 $ conda list                   
# packages in environment at /Users/ryanavery/mambaforge/envs/geo-ds-cholera:
#
# Name                    Version                   Build  Channel
affine                    2.4.0              pyhd8ed1ab_0    conda-forge
appnope                   0.1.3              pyhd8ed1ab_0    conda-forge
asttokens                 2.2.1              pyhd8ed1ab_0    conda-forge
astunparse                1.6.3              pyhd8ed1ab_0    conda-forge
attrs                     23.1.0             pyh71513ae_1    conda-forge
backcall                  0.2.0              pyh9f0ad1d_0    conda-forge
backports                 1.0                pyhd8ed1ab_3    conda-forge
backports.functools_lru_cache 1.6.5              pyhd8ed1ab_0    conda-forge
beautifulsoup4            4.12.2             pyha770c72_0    conda-forge
black                     23.3.0          py311h267d04e_1    conda-forge
blosc                     1.21.4               hc338f07_0    conda-forge
boost-cpp                 1.78.0               h9ed8d21_3    conda-forge
branca                    0.6.0              pyhd8ed1ab_0    conda-forge
brotli                    1.0.9                h1a8c8d9_9    conda-forge
brotli-bin                1.0.9                h1a8c8d9_9    conda-forge
brotli-python             1.0.9           py311ha397e9f_9    conda-forge
bzip2                     1.0.8                h3422bc3_4    conda-forge
c-ares                    1.19.1               hb547adb_0    conda-forge
ca-certificates           2023.5.7             hf0a4a13_0    conda-forge
cairo                     1.16.0            h1e71087_1016    conda-forge
certifi                   2023.5.7           pyhd8ed1ab_0    conda-forge
cffi                      1.15.1          py311hae827db_3    conda-forge
cfgv                      3.3.1              pyhd8ed1ab_0    conda-forge
cfitsio                   4.2.0                h2f961c4_0    conda-forge
cftime                    1.6.2           py311h4add359_1    conda-forge
charset-normalizer        3.1.0              pyhd8ed1ab_0    conda-forge
click                     8.1.4           unix_pyh707e725_0    conda-forge
click-plugins             1.1.1                      py_0    conda-forge
cligj                     0.7.2              pyhd8ed1ab_1    conda-forge
comm                      0.1.3              pyhd8ed1ab_0    conda-forge
contourpy                 1.1.0           py311he4fd1f5_0    conda-forge
curl                      8.1.2                h912dcd9_0    conda-forge
cycler                    0.11.0             pyhd8ed1ab_0    conda-forge
debugpy                   1.6.7           py311ha397e9f_0    conda-forge
decorator                 5.1.1              pyhd8ed1ab_0    conda-forge
distlib                   0.3.6              pyhd8ed1ab_0    conda-forge
docopt                    0.6.2                      py_1    conda-forge
execnb                    0.1.5              pyhd8ed1ab_0    conda-forge
executing                 1.2.0              pyhd8ed1ab_0    conda-forge
expat                     2.5.0                hb7217d7_1    conda-forge
fastcore                  1.5.29             pyhd8ed1ab_0    conda-forge
filelock                  3.12.2             pyhd8ed1ab_0    conda-forge
fiona                     1.9.4           py311h0e2296b_0    conda-forge
folium                    0.14.0             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                 hab24e00_0    conda-forge
fontconfig                2.14.2               h82840c6_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
fonttools                 4.40.0          py311heffc1b2_0    conda-forge
freetype                  2.12.1               hd633e50_1    conda-forge
freexl                    1.0.6                h1a8c8d9_1    conda-forge
gdal                      3.7.0           py311h509623a_3    conda-forge
geopandas                 0.12.2             pyhd8ed1ab_0    conda-forge
geopandas-base            0.12.2             pyha770c72_0    conda-forge
geos                      3.11.2               hb7217d7_0    conda-forge
geotiff                   1.7.1                h00e2a8a_9    conda-forge
gettext                   0.21.1               h0186832_0    conda-forge
ghapi                     1.0.4              pyhd8ed1ab_0    conda-forge
giflib                    5.2.1                h1a8c8d9_3    conda-forge
hdf4                      4.2.15               h8111dcc_6    conda-forge
hdf5                      1.14.1          nompi_h3aba7b3_100    conda-forge
icu                       72.1                 he12128b_0    conda-forge
identify                  2.5.24             pyhd8ed1ab_0    conda-forge
idna                      3.4                pyhd8ed1ab_0    conda-forge
importlib-metadata        6.7.0              pyha770c72_0    conda-forge
importlib_metadata        6.7.0                hd8ed1ab_0    conda-forge
ipykernel                 6.21.2             pyh736e0ef_0    conda-forge
ipython                   8.14.0             pyhd1c38e8_0    conda-forge
jedi                      0.18.2             pyhd8ed1ab_0    conda-forge
jinja2                    3.1.2              pyhd8ed1ab_1    conda-forge
joblib                    1.3.0              pyhd8ed1ab_1    conda-forge
json-c                    0.16                 hc449e50_0    conda-forge
jupyter_client            8.3.0              pyhd8ed1ab_0    conda-forge
jupyter_core              5.3.1           py311h267d04e_0    conda-forge
kealib                    1.5.1                h34092a9_4    conda-forge
kiwisolver                1.4.4           py311hd6ee22a_1    conda-forge
krb5                      1.20.1               h69eda48_0    conda-forge
lcms2                     2.15                 hd835a16_1    conda-forge
lerc                      4.0.0                h9a09cb3_0    conda-forge
libaec                    1.0.6                hb7217d7_1    conda-forge
libarchive                3.6.2                h82b9b87_1    conda-forge
libblas                   3.9.0           17_osxarm64_openblas    conda-forge
libbrotlicommon           1.0.9                h1a8c8d9_9    conda-forge
libbrotlidec              1.0.9                h1a8c8d9_9    conda-forge
libbrotlienc              1.0.9                h1a8c8d9_9    conda-forge
libcblas                  3.9.0           17_osxarm64_openblas    conda-forge
libcurl                   8.1.2                h912dcd9_0    conda-forge
libcxx                    16.0.6               h4653b0c_0    conda-forge
libdeflate                1.18                 h1a8c8d9_0    conda-forge
libedit                   3.1.20191231         hc8eb9b7_2    conda-forge
libev                     4.33                 h642e427_1    conda-forge
libexpat                  2.5.0                hb7217d7_1    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgdal                   3.7.0                ha0783c4_3    conda-forge
libgfortran               5.0.0           12_2_0_hd922786_31    conda-forge
libgfortran5              12.2.0              h0eea778_31    conda-forge
libglib                   2.76.4               h24e9cb9_0    conda-forge
libiconv                  1.17                 he4db4b2_0    conda-forge
libjpeg-turbo             2.1.5.1              h1a8c8d9_0    conda-forge
libkml                    1.3.0             h41464e4_1015    conda-forge
liblapack                 3.9.0           17_osxarm64_openblas    conda-forge
libnetcdf                 4.9.2           nompi_hf3c790a_107    conda-forge
libnghttp2                1.52.0               hae82a92_0    conda-forge
libopenblas               0.3.23          openmp_hc731615_0    conda-forge
libpng                    1.6.39               h76d750c_0    conda-forge
libpq                     15.3                 h7126958_1    conda-forge
librttopo                 1.1.0               h6ecf6d2_13    conda-forge
libsodium                 1.0.18               h27ca646_1    conda-forge
libspatialindex           1.9.3                hbdafb3b_4    conda-forge
libspatialite             5.0.1               h31468cf_27    conda-forge
libsqlite                 3.42.0               hb31c410_0    conda-forge
libssh2                   1.11.0               h7a5bd25_0    conda-forge
libtiff                   4.5.1                h23a1a89_0    conda-forge
libwebp-base              1.3.1                hb547adb_0    conda-forge
libxcb                    1.15                 hf346824_0    conda-forge
libxml2                   2.11.4               he3bdae6_0    conda-forge
libzip                    1.9.2                h76ab92c_1    conda-forge
libzlib                   1.2.13               h53f4e23_5    conda-forge
llvm-openmp               16.0.6               h1c12783_0    conda-forge
lz4-c                     1.9.4                hb7217d7_0    conda-forge
lzo                       2.10              h642e427_1000    conda-forge
mapclassify               2.5.0              pyhd8ed1ab_1    conda-forge
markupsafe                2.1.3           py311heffc1b2_0    conda-forge
matplotlib                3.6.3           py311ha1ab1f8_0    conda-forge
matplotlib-base           3.6.3           py311h99a5f44_0    conda-forge
matplotlib-inline         0.1.6              pyhd8ed1ab_0    conda-forge
munch                     4.0.0              pyhd8ed1ab_0    conda-forge
munkres                   1.1.4              pyh9f0ad1d_0    conda-forge
mypy_extensions           1.0.0              pyha770c72_0    conda-forge
nbdev                     2.2.10             pyhd8ed1ab_0    conda-forge
ncurses                   6.4                  h7ea286d_0    conda-forge
nest-asyncio              1.5.6              pyhd8ed1ab_0    conda-forge
netcdf4                   1.6.4           nompi_py311h724ebb5_101    conda-forge
networkx                  3.1                pyhd8ed1ab_0    conda-forge
nodeenv                   1.8.0              pyhd8ed1ab_0    conda-forge
nspr                      4.35                 hb7217d7_0    conda-forge
nss                       3.89                 h789eff7_0    conda-forge
numpy                     1.25.0          py311hb8f3215_0    conda-forge
openjpeg                  2.5.0                hbc2ba62_2    conda-forge
openssl                   3.1.1                h53f4e23_1    conda-forge
packaging                 23.1               pyhd8ed1ab_0    conda-forge
pandas                    1.5.3           py311h4eec4a9_1    conda-forge
parso                     0.8.3              pyhd8ed1ab_0    conda-forge
pathspec                  0.11.1             pyhd8ed1ab_0    conda-forge
pcre2                     10.40                hb34f9b4_0    conda-forge
pexpect                   4.8.0              pyh1a96a4e_2    conda-forge
pickleshare               0.7.5                   py_1003    conda-forge
pillow                    10.0.0          py311h095fde6_0    conda-forge
pip                       23.1.2             pyhd8ed1ab_0    conda-forge
pixman                    0.40.0               h27ca646_0    conda-forge
platformdirs              3.8.1              pyhd8ed1ab_0    conda-forge
pooch                     1.7.0              pyha770c72_3    conda-forge
poppler                   23.05.0              h16d8c84_1    conda-forge
poppler-data              0.4.12               hd8ed1ab_0    conda-forge
postgresql                15.3                 hb5ad9d5_1    conda-forge
pre-commit                3.2.2              pyha770c72_0    conda-forge
proj                      9.2.1                h8fdea58_0    conda-forge
prompt-toolkit            3.0.39             pyha770c72_0    conda-forge
prompt_toolkit            3.0.39               hd8ed1ab_0    conda-forge
psutil                    5.9.5           py311he2be06e_0    conda-forge
pthread-stubs             0.4               h27ca646_1001    conda-forge
ptyprocess                0.7.0              pyhd3deb0d_0    conda-forge
pure_eval                 0.2.2              pyhd8ed1ab_0    conda-forge
pycparser                 2.21               pyhd8ed1ab_0    conda-forge
pydap                     3.4.0              pyhd8ed1ab_0    conda-forge
pygments                  2.15.1             pyhd8ed1ab_0    conda-forge
pyparsing                 3.1.0              pyhd8ed1ab_0    conda-forge
pyproj                    3.6.0           py311h280d66e_1    conda-forge
pysocks                   1.7.1              pyha2e5f31_6    conda-forge
python                    3.11.3          h1456518_0_cpython    conda-forge
python-dateutil           2.8.2              pyhd8ed1ab_0    conda-forge
python_abi                3.11                    3_cp311    conda-forge
pytz                      2023.3             pyhd8ed1ab_0    conda-forge
pyyaml                    6.0             py311he2be06e_5    conda-forge
pyzmq                     25.1.0          py311hb1af645_0    conda-forge
rasterio                  1.3.8           py311h6456264_0    conda-forge
rasterstats               0.17.0             pyhd8ed1ab_0    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
requests                  2.31.0             pyhd8ed1ab_0    conda-forge
rioxarray                 0.14.1             pyhd8ed1ab_0    conda-forge
rtree                     1.0.1           py311hd698ff7_1    conda-forge
scikit-learn              1.3.0           py311hf0b18b8_0    conda-forge
scipy                     1.11.1          py311h93d07a4_0    conda-forge
setuptools                68.0.0             pyhd8ed1ab_0    conda-forge
shapely                   2.0.1           py311h7f8cfc4_1    conda-forge
simplejson                3.19.1          py311he2be06e_0    conda-forge
six                       1.16.0             pyh6c4a22f_0    conda-forge
snappy                    1.1.10               h17c5cce_0    conda-forge
snuggs                    1.4.7                      py_0    conda-forge
soupsieve                 2.3.2.post1        pyhd8ed1ab_0    conda-forge
sqlite                    3.42.0               h203b68d_0    conda-forge
stack_data                0.6.2              pyhd8ed1ab_0    conda-forge
threadpoolctl             3.1.0              pyh8a188c0_0    conda-forge
tiledb                    2.13.2               h9bd36d0_0    conda-forge
tk                        8.6.12               he1e0b03_0    conda-forge
tornado                   6.3.2           py311heffc1b2_0    conda-forge
traitlets                 5.9.0              pyhd8ed1ab_0    conda-forge
typing-extensions         4.7.1                hd8ed1ab_0    conda-forge
typing_extensions         4.7.1              pyha770c72_0    conda-forge
tzcode                    2023c                h1a8c8d9_0    conda-forge
tzdata                    2023c                h71feb2d_0    conda-forge
ukkonen                   1.0.1           py311hd6ee22a_3    conda-forge
urllib3                   2.0.3              pyhd8ed1ab_1    conda-forge
virtualenv                20.23.1            pyhd8ed1ab_0    conda-forge
wcwidth                   0.2.6              pyhd8ed1ab_0    conda-forge
webob                     1.8.7              pyhd8ed1ab_0    conda-forge
wheel                     0.40.0             pyhd8ed1ab_0    conda-forge
xarray                    2023.6.0           pyhd8ed1ab_0    conda-forge
xerces-c                  3.2.4                h68f8447_2    conda-forge
xorg-libxau               1.0.11               hb547adb_0    conda-forge
xorg-libxdmcp             1.1.3                h27ca646_0    conda-forge
xyzservices               2023.5.0           pyhd8ed1ab_1    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge
yaml                      0.2.5                h3422bc3_2    conda-forge
zeromq                    4.3.4                hbdafb3b_1    conda-forge
zipp                      3.15.0             pyhd8ed1ab_0    conda-forge
zlib                      1.2.13               h53f4e23_5    conda-forge
zstd                      1.5.2                h4f39d0f_7    conda-forge
rbavery commented 1 year ago

when I use xr.open_dataset(url, engine="rasterio", mask_and_scale=True) I get the same affine transform so it seems like this might just be a dataset issue where the affine transform is not read properly. I'm still wondering if this is a bug though that when we don't use engine=rasterio, .rio.transform is incorrect? Should anything be returned if the rasterio engine is not used to open the NetCDF?

snowman2 commented 1 year ago

Interestingly, it seems fine with older versions of rasterio/GDAL/PROJ:

>>> import rioxarray
>>> rds = rioxarray.open_rasterio("ESACCI-LST-L3S-LST-IRCDR_-0.01deg_1MONTHLY_DAY-20201101000000-fv2.00.nc")
>>> rds
<xarray.Dataset>
Dimensions:          (time: 1, x: 36000, y: 18000)
Coordinates:
  * time             (time) object 2020-11-01 00:00:00
  * x                (x) float64 -180.0 -180.0 -180.0 ... 180.0 180.0 180.0
  * y                (y) float64 89.99 89.98 89.97 89.96 ... -89.98 -89.99 -90.0
    spatial_ref      int64 0
Data variables: (12/13)
    dtime            (time, y, x) float32 ...
    lst_unc_loc_sfc  (time, y, x) int16 ...
    lcc              (time, y, x) int16 ...
    n                (time, y, x) int16 ...
    lst_unc_loc_cor  (time, y, x) int16 ...
    satze            (time, y, x) int16 ...
    ...               ...
    solze            (time, y, x) int16 ...
    solaz            (time, y, x) int16 ...
    lst              (time, y, x) int16 ...
    lst_uncertainty  (time, y, x) int16 ...
    lst_unc_ran      (time, y, x) int16 ...
    lst_unc_loc_atm  (time, y, x) int16 ...
Attributes: (12/41)
    cdm_data_type:              grid
    comment:                    These data were produced as part of the ESA L...
    Conventions:                CF-1.8
    creator_email:              djg20@le.ac.uk
    creator_name:               University of Leicester Surface Temperature G...
    creator_url:                https://climate.esa.int/en/projects/land-surf...
    ...                         ...
    summary:                    This file contains level L3S global land surf...
    time_coverage_duration:     P1M
    time_coverage_end:          20201130T235959
    time_coverage_resolution:   P1M
    time_coverage_start:        20201101T000000
    title:                      ESA LST CCI land surface temperature time ser...
>>> rds.lst.rio.transform()
Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, -0.009999999457435136, 89.9999874875217)
>>> rds.rio.transform()
Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, -0.009999999457435136, 89.9999874875217)
>>> rioxarray.show_versions()
rioxarray (0.14.0) deps:
  rasterio: 1.3.6
    xarray: 2023.3.0
      GDAL: 3.6.3
      GEOS: 3.11.2
      PROJ: 9.1.1
 PROJ DATA: ~/mambaforge/envs/rio/share/proj
 GDAL DATA: ~/mambaforge/envs/rio/share/gdal

Other python deps:
     scipy: 1.10.1
    pyproj: 3.5.0

System:
    python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
executable: ~/mambaforge/envs/rio/bin/python
   machine: Linux-5.19.0-46-generic-x86_64-with-glibc2.35
snowman2 commented 1 year ago

Seems to work with the latest version as well:

>>> import rioxarray
>>> rds = rioxarray.open_rasterio("ESACCI-LST-L3S-LST-IRCDR_-0.01deg_1MONTHLY_DAY-20201101000000-fv2.00.nc")
>>> rds
<xarray.Dataset>
Dimensions:          (time: 1, x: 36000, y: 18000)
Coordinates:
  * time             (time) object 2020-11-01 00:00:00
  * x                (x) float64 -180.0 -180.0 -180.0 ... 180.0 180.0 180.0
  * y                (y) float64 89.99 89.98 89.97 89.96 ... -89.98 -89.99 -90.0
    spatial_ref      int64 0
Data variables: (12/13)
    dtime            (time, y, x) float32 ...
    lst_unc_loc_sfc  (time, y, x) int16 ...
    lcc              (time, y, x) int16 ...
    n                (time, y, x) int16 ...
    lst_unc_loc_cor  (time, y, x) int16 ...
    satze            (time, y, x) int16 ...
    ...               ...
    solze            (time, y, x) int16 ...
    solaz            (time, y, x) int16 ...
    lst              (time, y, x) int16 ...
    lst_uncertainty  (time, y, x) int16 ...
    lst_unc_ran      (time, y, x) int16 ...
    lst_unc_loc_atm  (time, y, x) int16 ...
Attributes: (12/41)
    cdm_data_type:              grid
    comment:                    These data were produced as part of the ESA L...
    Conventions:                CF-1.8
    creator_email:              djg20@le.ac.uk
    creator_name:               University of Leicester Surface Temperature G...
    creator_url:                https://climate.esa.int/en/projects/land-surf...
    ...                         ...
    summary:                    This file contains level L3S global land surf...
    time_coverage_duration:     P1M
    time_coverage_end:          20201130T235959
    time_coverage_resolution:   P1M
    time_coverage_start:        20201101T000000
    title:                      ESA LST CCI land surface temperature time ser...
>>> rds.lst.rio.transform()
Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, -0.009999999457435136, 89.9999874875217)
>>> rds.rio.transform()
Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, -0.009999999457435136, 89.9999874875217)
>>> rioxarray.show_versions()
rioxarray (0.14.1) deps:
  rasterio: 1.3.8
    xarray: 2023.6.0
      GDAL: 3.7.0
      GEOS: 3.12.0
      PROJ: 9.2.1
 PROJ DATA: ~/mambaforge/envs/rio/share/proj
 GDAL DATA: ~/mambaforge/envs/rio/share/gdal

Other python deps:
     scipy: 1.11.1
    pyproj: 3.6.0

System:
    python: 3.11.4 | packaged by conda-forge | (main, Jun 10 2023, 18:08:17) [GCC 12.2.0]
executable: ~/mambaforge/envs/rio/bin/python
   machine: Linux-5.19.0-46-generic-x86_64-with-glibc2.35
snowman2 commented 1 year ago

I wonder if the OS & architecture has something to do with the issues you are seeing: macOS & arm64

snowman2 commented 1 year ago

Side note: These transforms are equivalent with the datasets width & height:

From xarray.open_dataset

Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, 0.009999999457435136, -90.00000274631076)

From rioxarray.open_rasterio:

Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, -0.009999999457435136, 89.9999874875217)

If you export them to a raster (.rio.to_raster(...)) and open them in QGIS, they will cover the same location.

snowman2 commented 1 year ago

I think this is likely a rasterio/GDAL issue specific to your OS & Architecture. I think you can confirm that by running this:

>>> with rasterio.open('NETCDF:"ESACCI-LST-L3S-LST-IRCDR_-0.01deg_1MONTHLY_DAY-20201101000000-fv2.00.nc":lst') as rds:
...     print(repr(rds.transform))
... 
Affine(0.009999999728725104, 0.0, -179.99999511705187,
       0.0, -0.009999999457435136, 89.9999874875217)
rbavery commented 12 months ago

On Ubuntu AMD when opening the URL I get this which is different

In [4]: with rasterio.open('https://dap.ceda.ac.uk/neodc/esacci/land_surface_temperature/data/MULTISENSOR_IRCDR/L3S/0.01/v2.00/mo
   ...: nthly/2020/11/ESACCI-LST-L3S-LST-IRCDR_-0.01deg_1MONTHLY_DAY-20201101000000-fv2.00.nc#mode=bytes') as rds:
   ...: 
   ...:          print(repr(rds.transform))
   ...: 
/home/rave/mambaforge/lib/python3.10/site-packages/rasterio/__init__.py:304: NotGeoreferencedWarning: Dataset has no geotransform, gcps, or rpcs. The identity matrix will be returned.
  dataset = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)
Affine(1.0, 0.0, 0.0,
       0.0, 1.0, 0.0)
snowman2 commented 12 months ago

Yes, I think this is not something solvable by rioxarray. It is something that needs to be handled by rasterio/GDAL.

rbavery commented 12 months ago

Got it thanks, I'll move this issue over to rasterio.