Skip to content

Commit 0661c82

Browse files
authored
Merge pull request #182 from seamanticscience/jml_interp
Add `path` input to `interpolation_setup` to direct where to save the coefficient file...
2 parents 90d9669 + e9c2340 commit 0661c82

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Interpolation.jl

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,22 +235,26 @@ function interpolation_setup(fil::String)
235235
end
236236

237237
"""
238-
interpolation_setup(;Γ,lon,lat,path,url)
238+
interpolation_setup(;Γ,lon,lat,filename)
239239
240240
Download or recompute interpolation coefficients.
241241
242242
- `λ=interpolation_setup()` to download "interp_coeffs_halfdeg.jld2"
243243
- `λ=interpolation_setup(Γ=Γ)` to recompute interpolation to `lon,lat`
244+
- `λ=interpolation_setup(Γ=Γ,lon=lon,lat=lat,filename=filename)` to
245+
recompute interpolation to `lon,lat` and save to location and file `filename`,
246+
defaulting to `tempname()*"_interp_coeffs.jld2"`.
244247
"""
245248
function interpolation_setup(;Γ=NamedTuple(),
246249
lon=[i for i=-179.:2.0:179., j=-89.:2.0:89.],
247-
lat=[j for i=-179.:2.0:179., j=-89.:2.0:89.])
250+
lat=[j for i=-179.:2.0:179., j=-89.:2.0:89.],
251+
filename=tempname()*"_interp_coeffs.jld2")
248252

249253
if isempty(Γ)
250254
fil=joinpath(MeshArrays.mydatadep("interp_halfdeg"),"interp_coeffs_halfdeg.jld2")
251255
else
252256
(f,i,j,w)=InterpolationFactors(Γ,vec(lon),vec(lat))
253-
fil=tempname()*"_interp_coeffs.jld2"
257+
fil=filename
254258
MeshArrays.write_JLD2(fil; lon=lon, lat=lat, f=f, i=i, j=j, w=w)
255259
end
256260
interpolation_setup(fil)

0 commit comments

Comments
 (0)