All values are nan after regridding
Added by sabbih shah over 2 years ago
Hi, I am trying to regrid a very high resolution(4Km) file to a coarse resolution say to 100 Km. But, the issue is that after regridding using the following command:
cdo remapbil,r288x192 data_2015_full.nc out.nc
All values in the resulting file out.nc
were nan. One thing I tried was to change the defualt _Fillvalue to 0.0 and tried to regrid again. Now this time all values were 0.0 instead.
Following is the file that I need to regrid:
<xarray.Dataset>
Dimensions: (time: 1, lat: 56391, lon: 58890)
Coordinates:
* time (time) datetime64[ns] 2015-01-01
* lat (lat) float64 0.0 21.95 21.98 22.02 ... 52.8 52.8 52.8 52.8
* lon (lon) float64 -130.1 -130.0 -129.9 ... -64.0 -63.93 -63.86
Data variables:
probability (time, lat, lon) float64 ...
Attributes:
NCO: netCDF Operators version 4.9.1 (Homepage = http://nco.sf.net, C...
history: Fri Sep 2 01:13:41 2022: ncatted -O -a missing_value,probabili...
And, here is the result for
cdo infov data_2015_full.nc
: -1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 2015-01-01 00:00:00 0 3320865990 3320847176 : -0.025154 0.065094 1.7328 : probability
cdo infon: Processed 1 variable over 1 timestep [20.51s 24GB].
And, this is the result after regridding cdo infov out.nc
:
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 2015-01-01 00:00:00 0 55296 55296 : nan : probability
cdo infon: Processed 1 variable over 1 timestep [0.01s 52MB].
Any help on this issue will be highly appreciated.
Replies (3)
RE: All values are nan after regridding - Added by Estanislao Gavilan over 2 years ago
Hi Sabbih,
it is really difficult to check the file because it is too big. Still there is something that does not make sense to me. The info reveals that the gridsize and the missing values are 3320865990 and 3320847176, respectively. That means that nearly the 99% of your data are missing values. You should recheck that file before regridding.
Kind regards
Estanislao
RE: All values are nan after regridding - Added by sabbih shah over 2 years ago
Thank you for your reply. Yes, I have double checked the data and confirmed that the probability variable is extremely sparse. I have created a smaller sample of the data for the state of Oregon USA. Following are the stats for the data_2015_oregon.nc
:
<xarray.Dataset>
Dimensions: (time: 1, lat: 9525, lon: 7285)
Coordinates:
* time (time) datetime64[ns] 2015-01-01
* lat (lat) float64 41.5 41.5 41.5 41.5 41.5 ... 46.5 46.5 46.5 46.5
* lon (lon) float64 -124.5 -124.5 -124.5 ... -116.5 -116.5 -116.5
Data variables:
probability (time, lat, lon) float64 ...
Attributes:
NCO: netCDF Operators version 4.9.1 (Homepage = http://nco.sf.net, C...
history: Fri Sep 2 01:13:41 2022: ncatted -O -a missing_value,probabili...
And, the output of cdo infov data_2015_oregon.nc
:
-1 : Date Time Level Gridsize Miss : Minimum Mean Maximum : Parameter name
1 : 2015-01-01 00:00:00 0 69389625 69388773 : 0.0087458 0.19681 0.82138 : probability
cdo infon: Processed 1 variable over 1 timestep [1.99s 581MB].
And, here is how the data looks like:
As this is just a single state of Oregon I regridded the data using the following configuration:
lat_range= [41.5, 46.5], increment=[0.10]
lon_range= [-124, -114.5], increment=[0.20]
But, the result is still nans.
RE: All values are nan after regridding - Added by Estanislao Gavilan over 2 years ago
Hi Sabbih,
this might be a consequence of too many missing values. Have you tried to fill the gaps with linear interpolation, and then regrid your data to a lower grid resolution?
Regards,
Estanislao