html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/7621#issuecomment-1469467986,https://api.github.com/repos/pydata/xarray/issues/7621,1469467986,IC_kwDOAMm_X85Xlk1S,5821660,2023-03-15T07:15:47Z,2023-03-15T07:15:47Z,MEMBER,"@RY4GIT Glad you can use the code. And good there's a way to use the data as is without tampering. Regarding the different rasterio-approaches, just to be on the same page. The code I provided above (with the `fn_NASA_Earthdata_download` file) works for you too, but with `fn_NSIDC_output` it does not? Out of the box, the second also doesn't work for me. Didn't check this. I've no immediate idea, what's going on in that case. The only thing I can think of is, that in the conversion process something has gone wrong with the georeferencing and/or the image origin. I hope you can figure that out, eventually. Here for reference my package versions:
INSTALLED VERSIONS ------------------ commit: None python: 3.10.5 | packaged by conda-forge | (main, Jun 14 2022, 07:06:46) [GCC 10.3.0] python-bits: 64 OS: Linux OS-release: 5.14.21-150400.24.46-default machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: de_DE.UTF-8 LOCALE: ('de_DE', 'UTF-8') libhdf5: 1.12.2 libnetcdf: 4.9.1 xarray: 2023.2.1.dev22+g49ae0f8d.d20230310 pandas: 1.4.2 numpy: 1.23.5 scipy: 1.9.1 netCDF4: 1.6.2 pydap: None h5netcdf: 1.1.0 h5py: 3.8.0 Nio: None zarr: 2.12.0 cftime: 1.5.1.1 nc_time_axis: 1.4.1 PseudoNetCDF: None rasterio: 1.3.6 cfgrib: None iris: 3.2.1 bottleneck: 1.3.5 dask: 2022.10.0 distributed: 2022.10.0 matplotlib: 3.6.3 cartopy: 0.21.1 seaborn: None numbagg: None fsspec: 2023.1.0 cupy: None pint: 0.17 sparse: None flox: None numpy_groupies: None setuptools: 59.2.0 pip: 21.3.1 conda: None pytest: 7.1.2 mypy: None IPython: 8.2.0 sphinx: None rioxarray: 0.13.3 gdal: 3.6.2 pyproj: 3.4.1 PROJ: 9.1.1
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1622197017 https://github.com/pydata/xarray/issues/7621#issuecomment-1468375177,https://api.github.com/repos/pydata/xarray/issues/7621,1468375177,IC_kwDOAMm_X85XhaCJ,5821660,2023-03-14T15:58:20Z,2023-03-14T15:58:20Z,MEMBER,@RY4GIT I forgot to add my package versions. I'll add them the next day. But I'm pretty sure to have the most recent one's installed in a Python 3.10 conda-forge environment.,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1622197017 https://github.com/pydata/xarray/issues/7621#issuecomment-1467552710,https://api.github.com/repos/pydata/xarray/issues/7621,1467552710,IC_kwDOAMm_X85XeRPG,5821660,2023-03-14T07:40:28Z,2023-03-14T07:41:24Z,MEMBER,"For the rasterio-approach: ```python ds_NASA_download_rasterio = xr.open_dataset(os.path.join(input_path, fn_NASA_Earthdata_download), engine='rasterio') ds_NASA_download_rasterio = ds_NASA_download_rasterio.set_coords([""cell_lat"", ""cell_lon""]) ds_NASA_download_rasterio.Geophysical_Data_precipitation_total_surface_flux[0].plot(y=""cell_lat"", x=""cell_lon"") ``` ![7621_2](https://user-images.githubusercontent.com/5821660/224929302-4d1f38b3-0c44-47a5-b98d-5be34dcebd30.png) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1622197017 https://github.com/pydata/xarray/issues/7621#issuecomment-1467520091,https://api.github.com/repos/pydata/xarray/issues/7621,1467520091,IC_kwDOAMm_X85XeJRb,5821660,2023-03-14T07:21:30Z,2023-03-14T07:35:37Z,MEMBER,"First, I've found this on SO: https://gis.stackexchange.com/questions/454543/fixing-the-flipped-inverted-y-axis-in-the-xarray-with-rasterio For your data reading method 1, it works for me like this: ```python # load root group with coordinates ds_NSIDC_root = xr.open_dataset(os.path.join(input_path, fn_NSIDC_output), group=""/"", engine='netcdf4') # load data from Geophysical_Data group ds_NSIDC_precip = xr.open_dataset(os.path.join(input_path, fn_NSIDC_output), group=""Geophysical_Data"", engine='netcdf4') # merge groups ds_NSIDC = xr.merge([ds_NSIDC_root, ds_NSIDC_precip]) # plot ds_NSIDC.precipitation_total_surface_flux.plot() # the above is essentially the same as # ds_NSIDC.precipitation_total_surface_flux.plot(x=""x"", y=""y"") ``` ![7621_0](https://user-images.githubusercontent.com/5821660/224922044-c1dc911e-42dd-472a-880f-dec6703a1fb4.png) This can be expanded to use the cell_lon/cell_lat: ``` # set lat/lon as coords ds_NSIDC = ds_NSIDC.set_coords([""cell_lon"", ""cell_lat""]) ds_NSIDC.precipitation_total_surface_flux.plot(x=""cell_lon"", y=""cell_lat"") ``` ![7621_1](https://user-images.githubusercontent.com/5821660/224922083-a462c64d-84b5-4a8e-a47e-b33dc38f670b.png) Update: This should also work like above when directly using NASA Earth Data. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1622197017 https://github.com/pydata/xarray/issues/7621#issuecomment-1466920659,https://api.github.com/repos/pydata/xarray/issues/7621,1466920659,IC_kwDOAMm_X85Xb27T,5821660,2023-03-13T20:36:54Z,2023-03-13T20:36:54Z,MEMBER,"@RY4GIT You would need to assign cell_lat/cell_lon as coordinates of the dataset and then use x=""cell_lon"" and y=""cell_lat"" in the call to .plot(). Plotting without that, will use the dimension coordinates (x,y) and there might be a difference in origin (upper vs. lower).","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1622197017