id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type
1622197017,I_kwDOAMm_X85gsMMZ,7621,Y-axis flipped when reading data with Xarray,52061672,closed,0,,,9,2023-03-13T20:16:33Z,2023-09-12T15:11:10Z,2023-09-12T15:11:09Z,NONE,,,,"#### Update
Update on March 15, 2023
First posted on March 13, 2023

#### Description
When reading data with Xarray using a rasterio engine, the Y axis is flipped. This happens with a specific dataset, and the summary is as follows. 

| Data\Engine | NetCDF4 | Rasterio |
| ------------- | ------------- | ------------- |
| 1. NSIDC output | ✅  | ❌ (Y axis is flipped)  |
| 2. NASA download  | ✅   | ✅   |

i.e., The issue happens with SMAP L4 data, pre-processed on the NSIDC server, read with rasterio engine. The issue does not happen with NetCDF4 engine.  It did not happen with the one directly downloaded from NASA Earth Data. 

<del>When reading data with Xarray using both the netcdf4 engine and the rasterio engine, the Y axis is flipped. However, when reading the same data with the netcdf4 package, the issue doesn't seem to be occurring. </del> 

It's unclear whether the issue is with Xarray or the data itself. 

![image](https://user-images.githubusercontent.com/52061672/225391882-5b5e9466-2822-4ff0-8b1a-23bfcacca1dc.png)


#### Details
I have created a Jupyter notebook with the details of the issue, including the code used to analyze the data, which is available [here](https://github.com/RY4GIT/sharing/blob/main/2_code_to_analyze/check_SMAPL4data.ipynb)

#### Data
- The data is SMAP L4 Geophysical data, precipitation (https://nsidc.org/data/spl4smgp/versions/7). The issue happens <del> for different versions of the dataset and</del> files for any dates or times. I tested it with two different versions of datasets. 
  - Dataset 1 is pre-processed & subset on NSIDC server
  - Dataset 2 is directly downloaded from NASA Earth Data portal

The data can be downloaded from the links provided by NASA and NSIDC (the links are specified in the notebook), or from my [Google Drive](https://drive.google.com/drive/folders/1vZFkW-ERw6zNucDNgyYrBfUz4NtBNXHO?usp=sharing). 

#### Environment Information
 - xarray version  2023.2.0 (the issue happened with 2023.1.0 too)
 - rioxarray version  0.13.3
 - rasterio version 1.3.6 (the issue happened with 1.3.4 too)
 - GDAL version  3.6.2
 - Python version 3.11 
 - Windows 11 
 (But I remember I've encountered this issues since a few years ago for SMAP data with ver 3.9 on Win 10)

#### Installation method
 - conda forge

Please let me know if you need any further information or have any suggestions on resolving this issue.
I am cross-posting this to [the rioxarray repo](https://github.com/corteva/rioxarray/issues/650). 

Thank you!","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7621/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue