0

I have a 3D array of float64, called A, with shape [396,380,1016]. 380 and 1016 are latitude (latmin=30.1875, latmax=45.9792) and longitude (lonmin=-6, lonmax=36.2917), respectively, representing a grid with resolution of ca. 0.041 degree. 396 is the 3rd dimension and accounts for monthly data.

I need an upscaled 3D array, B, achieved by resizing A to the new shape [396,128,344]; which actually have a resolution of 0.125 degree with (latmin=30.0626, latmax=45.9375) and (lonmin=-5.9375, lonmax=36.9375). The proportion with respect to A should be something like (1, 0.338, 0.339).

The new array should have the values on axis=0 [396] averaged among themselves according to the new (coarser) resolution. I thought about the conservative interpolation method in CDO, but unfortunately i'm not able to use it with Windows due to several errors, as well as i cannot use xESMF on Windows. There is a way by using xarray? should i have to regrid on a 2D level and then loop across the 3rd dimension?

Also consider that axis=0 contains several nan grid points, which must still be averaged as well and preserved in the 3D structure since represents the land mask.

what can be the best solution? Thanks

Guybrush
  • 3
  • 3
  • Isn't this downscaling since you reduce the resolution / size of the array!? – luk2302 Nov 13 '22 at 21:38
  • @luk2302 not in the typical meaning of the word as used in climate science. see e.g. https://www.gfdl.noaa.gov/climate-model-downscaling/ – Michael Delgado Nov 13 '22 at 21:46
  • @Guybrush can you clarify how this should happen? how exactly are you hoping to define the new grid? 128 doesn't divide evenly into 380, for example. it would be really helpful if you could set up a [mre] by defining the dimension coordinate arrays, both on the source and target dataset. we could demo this with random array *values*, but without a clear definition of the coordinates this problem is a little too unbounded. – Michael Delgado Nov 13 '22 at 21:50
  • also, it would be helpful if you could lay out anything you've tried or are envisioning as an approach for this workflow. Are you familiar with nco? xarray? ESMF? etc – Michael Delgado Nov 13 '22 at 21:52
  • Please provide enough code so others can better understand or reproduce the problem. – Community Nov 14 '22 at 10:02
  • Thanks guys for your answers and sorry for the lack of information. I have updated my answer hoping that is enough. – Guybrush Nov 15 '22 at 11:32

0 Answers0