Consider making logic for regridding to lower resolution more robust
Opened this issue · 0 comments
tomvothecoder commented
Overview
In this discussion, @chengzhuzhang and I talked about the logic for determining which variable has lower resolution.
My comment:
In the old version,
regrid_to_lower_res()
, there is a comment that says:e3sm_diags/e3sm_diags/driver/utils/general.py
Lines 246 to 248 in a2d00eb
I interpreted this comment as also meaning that if the lat lengths are the same, the resolutions are the same. Is this comment incorrect or am I misinterpreting it?
Here's a comparison of the logic.
1. If `ds_a` is lower res (a <= b): `return ds_a, ds_b_regrid` 2. Else always assume `ds_b` is lower res: `return ds_a_regrid, ds_b`
1. If `ds_a` is lower res (a < b): `return ds_a, ds_b_regrid` 2. If `ds_b` is lower res (b < a): `return ds_a_regrid, ds_b` 3. Otherwise same resolution (a = b): `return ds_a, ds_b` * Avoid unnecessary call to regridder APIs to possibly save on runtime, for example [for model-only runs ](https://github.com/E3SM-Project/e3sm_diags/blob/ae0d649eba7da29a410022f43ae9abc0d77af991/e3sm_diags/driver/lat_lon_driver.py#L87-L92) where `ds_a` and `ds_b` are the same datasets.
Possible Solutions:
@golaz suggested that comparing the number of grid points might be more robust. This involves taking the product of lat and lon.