Skip to content

Commit

Permalink
improve coverage_fraction
Browse files Browse the repository at this point in the history
  • Loading branch information
kongdd committed Jan 10, 2024
1 parent 1c1b839 commit e7a0b01
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ext/RbaseTerraExt/RbaseTerraExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ function NetCDFTools.coverage_fraction(f, shp; union=false)
""" |> rcopy

# return a mask, true is inside
data = nc_read(f, ind=(:, :, 1)) # time should be in the last

mask = falses(size(data))
dims = length.(nc_dims(f)[1:2])
# data = nc_read(f, ind=(:, :, 1)) # time should be in the last
mask = falses(dims...)
mask[info.cell] .= true
info, mask
end
Expand Down
1 change: 1 addition & 0 deletions src/nc_dim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function Ipaper.names(dims::Vector{NcDim})
map(x -> x.name, dims)
end

Base.length(dim::NcDim) = dim.dimlen

function find_dim(dims::Vector{NcDim}, name::AbstractString)
names = Ipaper.names(dims)
Expand Down

0 comments on commit e7a0b01

Please sign in to comment.