I'm trying to regrid the .nc file to upscale the resolution for a random forest model. I am using the xarray.interp for this purpose. For my .nc file only linear and slinear interpolation is working and other method are not working. I was trying to use cubic interpolation since my data has to be regridded to much lower resolution. The .nc file I am working is of resolution 0.05 degree and needs to be regridded to 0.25 degree resolution. I tried different interpolation method available for xarray. Initially I thought because the 'y' values are not in ascending order, I tried rearranging them in ascending order. But that did not work. Link to the nc file I am using: https://drive.google.com/file/d/1DyrfhVZvueG0yJ8Ca5dON33zga-qw-dP/view?usp=sharing import netCDF4 import xarray as xr import numpy as np import pandas as pd file_path_nc ="Combined_Day_LST.nc" dataset = xr.open_dataset(file_path_nc) regrid_lat = np.arange(21.125,31.875,0.25) regrid_lon = np.arange(76.125,91.875,0.25) data_array = dataset.interp(y = regrid_lat,x=regrid_lon,method='cubic') for variable in data_array.variables: print(variable) which = 'LST' var = data_array.metpy.parse_cf(which) values = var.isel(time=0) lons = data_array.metpy.parse_cf('x') lats = data_array.metpy.parse_cf('y') df = pd.DataFrame(data=values.values) df Continue reading...