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

Load data only once for ESMPy regridders #2418

Merged
merged 1 commit into from
May 14, 2024
Merged

Conversation

bouweandela
Copy link
Member

@bouweandela bouweandela commented May 14, 2024

Description

Realize the data only once for the ESMPy regridders.

Closes ESMValGroup/ESMValTool#3590

Test recipe:

documentation:
  description: Example recipe that shows slow regridding.
  title: Example recipe that shows slow regridding.
  authors:
    - andela_bouwe
  maintainer:
    - andela_bouwe
  references:
    - acknow_project
  projects:
    - esmval

preprocessors:
  time_ocean_zonal_mean:
    custom_order: true
    climate_statistics:
      operator: mean
      period: full
    extract_levels:
      levels: [ 0,  10, 20, 50, 100, 200, 300, 500, 750, 1000, 1250, 1500, 1750, 2000, 2250, 2500, 2750, 3000, 3250, 3500, 3750, 4000, 4250, 4500, 4750, 5000, 5250, 5500, 5750]
      scheme: linear_extrapolate
      coordinate: depth
    regrid:
      target_grid: 1x1
      scheme: nearest
    zonal_statistics:
      operator: mean

datasets:
  - dataset: CanESM5-1
    exp: piControl
    ensemble: r1i1p2f1
    grid: gn
    institute: CCCma

diagnostics:
  diagnostic1:
    variables:
      thetao:
        mip: Omon
        project: CMIP6
        timerange: 6191/6220
        preprocessor: time_ocean_zonal_mean
    scripts: null

With these changes, the recipe takes less than a minute to run on my laptop. I did not wait for the process to complete (killed it after about 10 minutes), but reportedly it takes about an hour without these changes.


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.


To help with the number pull requests:

@bouweandela bouweandela added preprocessor Related to the preprocessor dask related to improvements using Dask labels May 14, 2024
@bouweandela bouweandela marked this pull request as ready for review May 14, 2024 08:14
@bouweandela bouweandela requested a review from schlunma May 14, 2024 08:14
Copy link

codecov bot commented May 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.51%. Comparing base (a51da92) to head (f15cba0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2418   +/-   ##
=======================================
  Coverage   94.51%   94.51%           
=======================================
  Files         246      246           
  Lines       14020    14023    +3     
=======================================
+ Hits        13251    13254    +3     
  Misses        769      769           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@schlunma schlunma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Bouwe, looks great!

Would it maybe make sense to include that into v2.11.0? This sounds like a serious performance issue.

@bouweandela
Copy link
Member Author

@chrisbillowsMO @ehogan Would it be possible to include this in the upcoming v2.11 release?

@valeriupredoi valeriupredoi added this to the v2.11.0 milestone May 14, 2024
@valeriupredoi valeriupredoi added the enhancement New feature or request label May 14, 2024
Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and a very good spotting, cheers @bouweandela and @schlunma

@valeriupredoi valeriupredoi merged commit 8b06a18 into main May 14, 2024
7 checks passed
@valeriupredoi valeriupredoi deleted the fix-slow-esmpy-regrid branch May 14, 2024 09:02
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 enhancement New feature or request preprocessor Related to the preprocessor
Projects
Development

Successfully merging this pull request may close these issues.

Longer run time of recipes with 3D regridding in ESMValTool v2.10.0 compared to v2.5.0
3 participants