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

new dd version #105

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ClimateBase"
uuid = "35604d93-0fb8-4872-9436-495b01d137e2"
authors = ["Datseris <[email protected]>", "Philippe Roy <[email protected]>"]
version = "0.17.0"
version = "0.17.1"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Expand All @@ -20,7 +20,7 @@ GeoMakie = "db073c08-6b98-4ee5-b6a4-5efafb3259c6"
ClimateBaseVisualizations = "GeoMakie"

[compat]
DimensionalData = "0.20.1, 0.21, 0.22, 0.23, 0.24"
DimensionalData = "0.27"
GeoMakie = "0.6"
Interpolations = "0.13.2, 0.14, 0.15"
NCDatasets = "0.11, 0.12"
Expand Down
6 changes: 0 additions & 6 deletions src/core/coredefs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ DimensionalData.rebuild(
data=gnv(A), dims=dims(A), refdims=refdims(A), name=name(A), metadata=metadata(A)
) = ClimArray(data, format(dims, data), refdims, name, metadata)


# The following basic methods allow indexing with tuples, (Time(5), Lon(3))
Base.getindex(A::ClimArray, i::Tuple) = A[i...]
Base.setindex!(A::ClimArray, x, i::Tuple) = setindex!(A, x, i...)
Base.view(A::ClimArray, i::Tuple) = view(A, i...)

# Convenience
Base.ones(A::AbDimArray) = basetypeof(A)(ones(eltype(A), size(A)), dims(A))
Base.zeros(A::AbDimArray) = basetypeof(A)(zeros(eltype(A), size(A)), dims(A))
14 changes: 7 additions & 7 deletions src/interpolations/height_interpolation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ function interpolation2pressure(A::ClimArray, pressure::ClimArray, pressure_leve
# construct output Array:
pre = Pre(pressure_levels; metadata = Dict())
dims_no_height = otherdims(A, vertical_dim)
out_dims = (dims_no_height...,pre)
out_dims = (dims_no_height..., pre)
dimension_lengths = length.(out_dims)

B = ClimArray(
zeros(eltype(A), Tuple(dimension_lengths)), out_dims;
name = A.name, attrib = A.attrib
)
for i in otheridxs(A, vertical_dim)
itp = LinearInterpolation(pressure[i],A[i],extrapolation_bc=extrapolation_bc)
B[i] = itp(pressure_levels)
itp = LinearInterpolation(pressure[i], A[i...]; extrapolation_bc)
B[i...] = itp(pressure_levels)
end
return B
end
Expand Down Expand Up @@ -105,8 +105,8 @@ function interpolate_height2pressure(A::ClimArray,pressure_levels::Vector; extra
int_array = ClimArray(zeros(eltype(A), Tuple(dimension_lengths)), out_dims; name = A.name, attrib = A.attrib)

for i in otheridxs(A, Hei())
itp = LinearInterpolation(pressure,A[i],extrapolation_bc=extrapolation_bc)
int_array[i] = itp(pressure_levels)
itp = LinearInterpolation(pressure, A[i...]; extrapolation_bc)
int_array[i...] = itp(pressure_levels)
end
return int_array
end
Expand Down Expand Up @@ -136,8 +136,8 @@ function interpolate_pressure2height(A::ClimArray,heights::Vector; extrapolation

for i in otheridxs(A, Pre())

itp = LinearInterpolation(height,A[i],extrapolation_bc=extrapolation_bc)
int_array[i] = itp(heights)
itp = LinearInterpolation(height,A[i...]; extrapolation_bc)
int_array[i...] = itp(heights)

end
return int_array
Expand Down
Loading