Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically select a lazy regridding scheme in regrid preprocessor function for 2D lat/2D lon grids when possible #2405

Closed
bouweandela opened this issue May 6, 2024 · 6 comments · Fixed by #2457
Labels
dask related to improvements using Dask preprocessor Related to the preprocessor

Comments

@bouweandela
Copy link
Member

bouweandela commented May 6, 2024

Through iris-esmf-regrid and the generic regridding schemes, it is possible to regrid grids with 2D latitude and 2D longitude coordinates lazily. However, these regridding schemes are not automatically selected and instead the non-lazy ESMPyLinear/ESMPyNearest/ESMPyAreaWeighted built-in schemes are selected. This results in poor computational performance by default.

@schlunma @sloosvel Do you think it would be possible to improve the default so we prefer lazy schemes and automatically select those when possible?

@sloosvel
Copy link
Contributor

sloosvel commented May 6, 2024

I'm not sure this is possible because the generic regridding schemes don't work for all models, you can get results such as this one using ESMFAreaWeighted:

image

@bouweandela
Copy link
Member Author

bouweandela commented May 6, 2024

Could you provide some more details on that image, to help me understand the issue?

  • What was the source grid or model?
  • What was the target grid?
  • Which regridding scheme was used?
  • Does the image look as expected?

@sloosvel
Copy link
Contributor

sloosvel commented May 6, 2024

It happens to models that have OceanGridFix applied to them. The generated bounds work fine to regrid with the non-lazy regridders, but for some reason when you call the lazy AreaWeighted scheme, this happens. You can check with the recipe below for instance:

documentation:
  title: test regrid
  description: |
    Test regrid
  authors:
     - loosveldt-tomas_saskia

datasets:
   - {dataset: FGOALS-g3, ensemble: r1i1p1f1, exp: historical, project: CMIP6, grid: gn, timerange: 1951/1951}


preprocessors:
  pp:
    regrid:
      target_grid: 1.5x1.5
      scheme: 
        reference: esmf_regrid.schemes:ESMFAreaWeighted

diagnostics:
  test_regrid:
    variables:
      tos:
        mip: Omon
        preprocessor: pp
    scripts: null

@bouweandela
Copy link
Member Author

bouweandela commented May 21, 2024

An overview of regridding a 2D ocean variable (sea surface temperature) for most models in CMIP6 to a 1x1 grid is available here and with xesmf here. Created with the debug-regrid branch which keeps going when a regridding error occurs and adds a bit of info.

A first inspection reveals the following issues:

  • iris-esmf-regrid lazy regridders:
    • Linear:
      • 1D grids not supported: AWI-CM-1-1-MR
      • discontiguous grids: 2D variables supported with use_src_mask: true, 3D (i.e. with vertical dimension) variables not supported: CMCC-CM2-SR5, CMCC-ESM2, CNRM-CM6-1-HR, CNRM-CM6-1, CNRM-ESM2-1, CanESM5-1, CanESM5-CanOE, CanESM5, EC-Earth3-Veg-LR, EC-Earth3-Veg, EC-Earth3, GFDL-ESM4, IPSL-CM6A-LR, IPSL-CM6A-LR, MPI-ESM1-2-HR, MPI-ESM1-2-LR, MRI-ESM2-0, NESM3, TaiESM1
      • masked vertical stripe in CESM2-WACCM, CESM2, CIESM, FGOALS-f3-L, FGOALS-g3, FIO-ESM-2-0
    • Nearest Neighbour:
    • Area Weighted:
      • 1D grids not supported: AWI-CM-1-1-MR
      • 3D variables discontiguous grids not supported
      • results look wrong for BCC-CSM2-MR , FGOALS-f3-L, FGOALS-g3, FIO-ESM-2-0, KACE-1-0-G (deformed continents), and INM-CM4-8 (a large non-existent sea appears in Asia)
  • Built-in (mostly non-lazy ESMPy based) regridders from esmvalcore.preprocessor.regrid_schemes:
    • Linear:
      • (non esmpy based regridder) 1D grids produce results that look wrong: AWI-CM-1-1-MR
      • suspicous values vertical stripe in NESM3
      • masked vertical stripe in FGOALS-f3-L, FGOALS-g3, FIO-ESM-2-0, MRI-ESM2-0, TaiESM1
    • Nearest Neighbour:
      • (non esmpy based regridder) 1D grids produce results that look wrong: AWI-CM-1-1-MR
      • suspicious values vertical stripe in NESM3
      • masked vertical stripe in CMCC-CM2-SR5, CMCC-ESM2, CNRM-CM6-1, CNRM-ESM2-1, IPSL-CM6A-LR
    • Area Weighted:
      • not supported: AWI-CM-1-1-MR
      • results look wrong for BCC-CSM2-MR, FGOALS-f3-L, FGOALS-g3, FIO-ESM-2-0
      • vertical band of high values in CNRM-CM6-1-HR, EC-Earth3-Veg-LR, EC-Earth3-Veg, EC-Earth3, GFDL-ESM4, IITM-ESM, MPI-ESM1-2-HR, MPI-ESM1-2-LR (band is slightly tilted), MRI-ESM2-0, NESM3
      • masked vertical stripe in CanESM5-1, CanESM5-CanOE, CanESM5, GFDL-ESM4, MRI-ESM2-0, TaiESM1

@bouweandela
Copy link
Member Author

It happens to models that have OceanGridFix applied to them.

@sloosvel I tried the recipe, but am getting poor results with all available regridders. Did I miss something?
I ran this recipe and got the following images:
tos_default_CMIP6_FGOALS-g3_Omon_historical_r1i1p1f1_tos_gn_195101-195101
Default built-in ESMPy based regridder
tos_esmpy_CMIP6_FGOALS-g3_Omon_historical_r1i1p1f1_tos_gn_195101-195101
iris-esmf-regrid regridder
tos_xesmf_CMIP6_FGOALS-g3_Omon_historical_r1i1p1f1_tos_gn_195101-195101
xesmf regridder from #2433

@sloosvel
Copy link
Contributor

You are right, I don't know why I was under the impression it worked for the non-lazy schemes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dask related to improvements using Dask preprocessor Related to the preprocessor
Projects
Development

Successfully merging a pull request may close this issue.

2 participants