Skip to content

Commit

Permalink
RegionGrids are the same type as the parent lon/lat vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
natgeo-wong committed Jul 26, 2022
1 parent 0c73ae8 commit 8a6b104
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Extract.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ function RegionGrid(
end

function RectGrid(
geo :: RectRegion{ST,FT},
geo :: RectRegion,
lon :: Vector{<:Real},
lat :: Vector{<:Real}
) where {FT <: Real, ST <: AbstractString}
)

@info "$(modulelog()) - Creating a RegionGrid for the $(geo.name) GeoRegion"

Expand Down Expand Up @@ -62,15 +62,15 @@ function RectGrid(
nlon = nlon[iWE]
nlat = lat[iNS]

return RectGrid{FT}(igrid,iWE,iNS,nlon,nlat)
return RectGrid{eltype(lon)}(igrid,iWE,iNS,nlon,nlat)

end

function PolyGrid(
geo :: PolyRegion{ST,FT},
geo :: PolyRegion,
lon :: Vector{<:Real},
lat :: Vector{<:Real}
) where {FT <: Real, ST <: AbstractString}
)

@info "$(modulelog()) - Creating a RegionGrid for the $(geo.name) GeoRegion"

Expand Down Expand Up @@ -102,7 +102,7 @@ function PolyGrid(
@info "$(modulelog()) - Since the $(geo.name) GeoRegion is a PolyRegion, we need to defined a mask as well ..."
nlon = nlon[iWE]
nlat = lat[iNS]
mask = Array{FT,2}(undef,length(nlon),length(nlat))
mask = Array{eltype(lon),2}(undef,length(nlon),length(nlat))
for ilat in eachindex(nlat), ilon in eachindex(nlon)
ipnt = Point2(nlon[ilon],nlat[ilat])
if isinGeoRegion(ipnt,geo,throw=false)
Expand All @@ -111,7 +111,7 @@ function PolyGrid(
end
end

return PolyGrid{FT}(igrid,iWE,iNS,nlon,nlat,mask)
return PolyGrid{eltype(lon)}(igrid,iWE,iNS,nlon,nlat,mask)

end

Expand Down

2 comments on commit 8a6b104

@natgeo-wong
Copy link
Member Author

Choose a reason for hiding this comment

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

@JuliaRegistrator register

Release Notes:

  • Debugging the methods for RegionGrid

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/65247

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.0.1 -m "<description of version>" 8a6b1044fe4c21f5a6782c09846dbf2df6eedf71
git push origin v3.0.1

Please sign in to comment.