I'm working with NOAA temperature NetCDF files and trying limit area of interest to the US area only using bounding box. In Jupyter Notebook I wrote few lines to do it and on the plot everything looks good until I load *.nc file to ArcGIS Pro / QGIS, raster is streched along y-axis...
import os, sys
import xarray as xr
from netCDF4 import Dataset
import pandas as pd
import numpy as np
from datetime import date
import rioxarray
import matplotlib.pyplot as plt
%matplotlib inline
ds = xr.open_dataarray(r"C:\Users\test\Downloads\tmax.2022.nc")
new = ds.rio.write_crs("epsg:4326", inplace=True)
new.coords['lon'] = (new.coords['lon'] + 180) % 360 -180
lats = [72, 24]
lons = [-65, -172]
out = new.sel(lat=slice(*lats), lon=slice(*lons))
out.to_netcdf(path_to_output)