Skip to content

Enable interpolation_setup to download precomputed weights for LLC90 or LLC270#220

Open
seamanticscience wants to merge 5 commits intoJuliaClimate:masterfrom
seamanticscience:jml_llc270
Open

Enable interpolation_setup to download precomputed weights for LLC90 or LLC270#220
seamanticscience wants to merge 5 commits intoJuliaClimate:masterfrom
seamanticscience:jml_llc270

Conversation

@seamanticscience
Copy link
Copy Markdown
Contributor

I added a method to interpolation_setup, which allows down/loading of precomputed interpolation weights based on the GridSpec (i.e. either 0.5° for ID=:LLC90 or 0.25° for ID=:LLC270).

γ=GridSpec(ID=:LLC270)
 gcmgrid 
  class        = LatLonCap
  path         = /Users/jml1/.julia/artifacts/1bc43784dfbcb787cc4e8018ab61d5c3cdcd5ea3/GRID_LLC270-1.0.0/
  fSize        = [(270, 810), (270, 810), (270, 270), (810, 270), (810, 270)]
  ioSize       = [270 3510]
  ioPrec       = Float32

λ=interpolation_setup(γ)
(lat = [-89.875 -89.625  89.625 89.875; -89.875 -89.625  89.625 89.875;  ; -89.875 -89.625  89.625 89.875; -89.875 -89.625  89.625 89.875], f = [4 4 4 4; 4 4 4 4;  ; 3 3 3 3; 3 3 3 3], w = [0.038147161848044925 0.32800134934748143 0.5678137074351091 0.06603778136936453; 0.03588516073953725 0.319724971993188 0.5793635031754644 0.06502636409181044;  ; 0.30958104671667847 0.3210276065472765 0.1880481964656952 0.18134315027034986; 0.3070680754881118 0.31913638642184666 0.19049969226156438 0.1832958458284772], j = [40 40 41 41; 40 40 41 41;  ; 135 135 136 136; 135 135 136 136], lon = [-179.875 -179.875  -179.875 -179.875; -179.625 -179.625  -179.625 -179.625;  ; 179.625 179.625  179.625 179.625; 179.875 179.875  179.875 179.875], i = [808 809 809 808; 808 809 809 808;  ; 136 137 137 136; 136 137 137 136])

This could be expanded to other model grids (for example ID=:CS32), but currently supplying an unrecognized gcmgrid falls back on calculating interpolation weights on the default 2° grid.

γ=GridSpec(ID=:CS32)
 gcmgrid 
  class        = CubeSphere
  path         = /Users/jml1/.julia/artifacts/e425ca76b87758101e7f7543eee62d34f7b4553f/GRID_CS32-1.1/
  fSize        = [(32, 32), (32, 32), (32, 32), (32, 32), (32, 32), (32, 32)]
  ioSize       = [32 192]
  ioPrec       = Float32

λ=interpolation_setup(γ)
(lat = [-89.0 -87.0  87.0 89.0; -89.0 -87.0  87.0 89.0;  ; -89.0 -87.0  87.0 89.0; -89.0 -87.0  87.0 89.0], f = [6 6 6 6; 6 6 6 6;  ; 3 3 3 3; 3 3 3 3], w = [0.4266968067160594 0.41659067208909717 0.07741722267931467 0.07929529851552865; 0.4365801480888083 0.40628908780280665 0.07574189695964063 0.08138886714874438;  ; 0.08138952033431214 0.43657942774664493 0.40628852672078924 0.07574252519825363; 0.07929594418742816 0.4266961386495333 0.4165900571683199 0.07741785999471859], j = [16 16 17 17; 16 16 17 17;  ; 16 16 17 17; 16 16 17 17], lon = [-179.0 -179.0  -179.0 -179.0; -177.0 -177.0  -177.0 -177.0;  ; 177.0 177.0  177.0 177.0; 179.0 179.0  179.0 179.0], i = [16 17 17 16; 16 17 17 16;  ; 16 17 17 16; 16 17 17 16])

All other behavior is the same, including interpolation_setup with no arguments, and interpolation_setup with a path to saved JLD2 weight file.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.80%. Comparing base (68950c3) to head (ce5feb2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #220      +/-   ##
==========================================
+ Coverage   87.75%   87.80%   +0.04%     
==========================================
  Files          37       37              
  Lines        3398     3410      +12     
==========================================
+ Hits         2982     2994      +12     
  Misses        416      416              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant