This PR adds the ability to coarsen restart files on pressure levels with extrapolation via a newly added extrapolate keyword argument to coarsen_restarts_on_pressure. The extrapolation is limited in the sense that we have only shifted the threshold for masking to the coarse grid's vertical layer midpoint pressures instead of the coarse grid's vertical layer bottom interface pressures. Using the latter results in zero extrapolation; using the former results in allowing values filled with nearest neighbor extrapolation to be included in averages if extrapolation was not required too far. This is mostly relevant over ocean where our default no-extrapolation approach requires masking roughly 50% of the grid cells in the lowest model level; this limited extrapolation approach enables retaining 100% of the grid cells over most ocean regions while maintaining the mask over land regions with variable topography.
The above figure shows the fraction of the area of the C3072 grid cells left unmasked in the lowest model level when coarsening to C48 resolution for three different approaches. The left and middle panels represent our default and this new limited extrapolation approach. Unlimited extrapolation, the right panel, obviously results in no masking ever occurring. This plot was produced in this notebook (though note that it uses a modified version of the code in this PR to enable experimenting with the different options and easy access to the masked_area_weights used in the process).
An accompanying PR adding this option in the fortran can be found here: ai2cm/fv3gfs-fortran#366. This notebook checks that the offline approach implemented here approximately produces the same results as the online approach implemented in ai2cm/fv3gfs-fortran#366.
This PR adds the ability to coarsen restart files on pressure levels with extrapolation via a newly added
extrapolate
keyword argument tocoarsen_restarts_on_pressure
. The extrapolation is limited in the sense that we have only shifted the threshold for masking to the coarse grid's vertical layer midpoint pressures instead of the coarse grid's vertical layer bottom interface pressures. Using the latter results in zero extrapolation; using the former results in allowing values filled with nearest neighbor extrapolation to be included in averages if extrapolation was not required too far. This is mostly relevant over ocean where our default no-extrapolation approach requires masking roughly 50% of the grid cells in the lowest model level; this limited extrapolation approach enables retaining 100% of the grid cells over most ocean regions while maintaining the mask over land regions with variable topography.The above figure shows the fraction of the area of the C3072 grid cells left unmasked in the lowest model level when coarsening to C48 resolution for three different approaches. The left and middle panels represent our default and this new limited extrapolation approach. Unlimited extrapolation, the right panel, obviously results in no masking ever occurring. This plot was produced in this notebook (though note that it uses a modified version of the code in this PR to enable experimenting with the different options and easy access to the
masked_area_weights
used in the process).An accompanying PR adding this option in the fortran can be found here: ai2cm/fv3gfs-fortran#366. This notebook checks that the offline approach implemented here approximately produces the same results as the online approach implemented in ai2cm/fv3gfs-fortran#366.
Coverage reports (updated automatically):