3
$\begingroup$

I have two datasets, each with two differing resolutions. The first dataset is a coarser resolution data set that has 0.5 x 0.625 degree resolution and contains values of MERRA-2 boundary layer thickness. The second, finer resolution dataset has 0.1 x 0.1 degree resolution and contains values of IMERG rainfall rate. I want to find the boundary layer thickness at every point where the rainfall rate exceeds 10 mm/hr. Since the MERRA-2 boundary layer thickness dataset is coarser, I figured that I could create a grid from the latitude and longitude values in the MERRA-2 dataset and check if the IMERG data points lie within any of the MERRA-2 grid boxes. I'm having trouble figuring out where to start with this, and any help is greatly appreciated.

Here is the formatting of the latitude and longitude for each dataset:

MERRA-2 Latitude: [[1.3500000e+01  1.3500000e+01  1.3500000e+01  1.3500000e+01]
MERRA-2 Longitude: [[-51.875 -51.25  -50.625 -50.    -49.375 -48.75  -48.125 -47.5   -46.875]
IMERG Latitude: [-0.05  0.05  0.15  0.25  0.35  0.45  0.55  0.65  0.75  0.85  0.95  1.05]
IMERG Longitude: [-49.95 -49.85 -49.75 -49.65 -49.55 -49.45 -49.35 -49.25 -49.15 -49.05]

EDIT: I have created a regridded dataset from Nemesi's first methodology (cdo remapcon), and they can be found below. The top image is the regridded data, and the bottom is the original data. Although the number of points in the newly regridded dataset increased from 59,040 to 5,475,600, the image seems to have lower resolution than the original image. The IMERG data also seems to have higher resolution even though both datasets have the same amount of points. Is this due to an error with the data formatting?

Original dataset Newly regridded dataset

$\endgroup$
4
  • 2
    $\begingroup$ You should use a GIS approach. You could even use python (e.g. geopandas) really quickly. In my experience it's much faster to load geospatial data (e.g. the native NetCDF?) because it is time-consuming to recreate grids from the lat/long text outputs. $\endgroup$
    – f.thorpe
    Jul 26, 2021 at 19:50
  • $\begingroup$ By GIS approach do you mean nearest neighbor or nearest point interpolation? $\endgroup$
    – mpletch1
    Jul 26, 2021 at 20:35
  • $\begingroup$ If it's just a single dataset, you can do what's commonly referred to as an "intersect", which is a type of spatial join. That would require conversion from raster to polygon, but that would likely be too time consuming if you are dealing with timeseries data. If you are using time-series data, I would suggest you use the proper raster tool to convert from one grid to the other and get them directly comparable. $\endgroup$
    – f.thorpe
    Jul 26, 2021 at 20:47
  • $\begingroup$ Unfortunately, I don't have access to ArcMap software as of now and I'm having trouble installing the geopandas Python library onto my Python environment. $\endgroup$
    – mpletch1
    Jul 29, 2021 at 14:26

1 Answer 1

5
$\begingroup$

Note: I'm assuming that the original data are provided in NetCDF format.

There are two (OK, there are more, but I'll focus on these two) relatively quick ways to deal with this issue. Which one to prefer is very much depending on your preference and ability to use the different tools involved.

The fastest approach that comes to my mind is using the Climate Data Operator (CDO): you can find a detailed documentation here and an overview here.

The approach should be to get the grid description from the highest resolution file:

cdo -griddes imerg.nc

Then, take the description of the grid and put it in a .txt file and remap the coarser resolution file to match this grid. In this case, you may want to use a conservative remapping methodology to maintain the original values unaltered.

cdo remapcon,imerggrid.txt merra_coarse.nc merra_imerggrid.nc

In this way you would have the MERRA-2 data in a resolution matching your IMERG grid.

The second approach uses R. Steps (very quickly):

  1. load the two NetCDF files as raster;
  2. make a raster to point transformation (or just extract the coordinates and transform them in a Point Spatial object) of the imerg raster (in this way you would obtain the centroids of the imerg cells);
  3. extract the data from the merra object overlaying the imerg points. All these passages are well documented in stackoverflow or gis.stackexchange.

This last methodology, however, may result in a very slow process in case of large datasets.

$\endgroup$
8
  • $\begingroup$ After performing the above methodology, it appears that the newly regridded image has lower resolution than before. Is this meant to occur or did I make an error somewhere? $\endgroup$
    – mpletch1
    Jul 27, 2021 at 19:13
  • $\begingroup$ the regridded image should have now the same resolution as your imerg data $\endgroup$
    – Nemesi
    Jul 28, 2021 at 7:15
  • $\begingroup$ It's odd because the number of points in the regridded image increased to 5,475,600 from 59,040 and the image appears to be less detailed. I'm going to link some images to my initial questions. $\endgroup$
    – mpletch1
    Jul 28, 2021 at 18:36
  • 1
    $\begingroup$ the reason why the image looks scattered, is due to the conservative remapping. If you want a smoother image, you should use the bilinear interpolation remapping command (remapbil). the reason why I originally suggested the remapcon is because you asked for "I want to find the boundary layer thickness at every point where the rainfall rate exceeds 10 mm/hr"and I thought you wanted the original data. Remapping with a biliniear interpolation will alter the data to make the smoothing. $\endgroup$
    – Nemesi
    Jul 29, 2021 at 8:08
  • $\begingroup$ @mpletch1 It looks to me like you're also plotting with contouring/interpolation on, which is why the coarse IMERG data in the lower plot appears smooth and more detailed. If you are, then I recommend switching it off, as it makes it harder to assess the regridding. $\endgroup$
    – Deditos
    Jul 29, 2021 at 10:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.