Skip to content
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
17 changes: 9 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ jobs:
version:
- '1' # Replace this with the minimum Julia version that your package supports. E.g. if your package requires Julia 1.5 or higher, change this to '1.5'.
#- '1' # Leave this line unchanged. '1' will automatically expand to the latest stable 1.x release of Julia.
#- 'nightly'
- '~1.10.0-0'
- 'nightly'
os:
- ubuntu-latest
#- ubuntu-20.04
Expand All @@ -53,15 +54,15 @@ jobs:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
if: matrix.run_in_pr == true || github.event_name != 'pull_request'

- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v1
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
Expand All @@ -74,7 +75,7 @@ jobs:
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
- uses: codecov/codecov-action@v5
with:
file: lcov.info

Expand All @@ -83,8 +84,8 @@ jobs:
runs-on: ubuntu-latest
#runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: '1'
- run: |
Expand Down
18 changes: 12 additions & 6 deletions src/spectral_indices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -535,10 +535,15 @@
o = sp_indices(@view(cube[:,:,bands[1]]), @view(cube[:,:,bands[2]]), @view(cube[:,:,bands[3]]); index=index, kw...)
end
if (mask || classes !== nothing)
O = mat2img(o, cube)
O.layout, O.range[5], O.range[6] = "BRPa", 0, (mask) ? 255 : length(classes)
if (isa(o, Matrix{<:Integer}))

Check warning on line 538 in src/spectral_indices.jl

View check run for this annotation

Codecov / codecov/patch

src/spectral_indices.jl#L538

Added line #L538 was not covered by tests
# Don't know if this case still happens. It was for old code. Now, for masks, 'o' is already a GMTimage
O = mat2img(o, cube)
O.layout, O.range[5], O.range[6] = "BRPa", 0, (mask) ? 255 : length(classes)

Check warning on line 541 in src/spectral_indices.jl

View check run for this annotation

Codecov / codecov/patch

src/spectral_indices.jl#L540-L541

Added lines #L540 - L541 were not covered by tests
else
O = o

Check warning on line 543 in src/spectral_indices.jl

View check run for this annotation

Codecov / codecov/patch

src/spectral_indices.jl#L543

Added line #L543 was not covered by tests
end
else
O = mat2grid(o, cube)
O = isa(o, GMT.GMTgrid) ? o : mat2grid(o, cube)
end
O.names = [index * " index"]
(save_name != "") && gmtwrite(save_name, O)
Expand Down Expand Up @@ -781,13 +786,14 @@
end
end

if (isa(bnd1, GMT.GMTimage) || isa(bnd1, GMT.GMTgrid))
if (isa(bnd1, GMT.GMTimage) || isa(bnd1, GMT.GMTgrid) || isa(parent(bnd1), GMTimage)) # Last one is when slice is a SubArray{...
if (ismask || classes !== nothing)
I = mat2img(mask, proj4=bnd1.proj4, wkt=bnd1.wkt, x=bnd1.x, y=bnd1.y, epsg=bnd1.epsg, layout="BRPa")
I = mat2img(mask, isa(bnd1, GMT.GMTimage) ? bnd1 : parent(bnd1))
I.layout="BRPa"

Check warning on line 792 in src/spectral_indices.jl

View check run for this annotation

Codecov / codecov/patch

src/spectral_indices.jl#L791-L792

Added lines #L791 - L792 were not covered by tests
I.range[5], I.range[6] = 0, (ismask) ? 255 : length(classes)
return I
else
return mat2grid(img, bnd1)
return mat2grid(img, isa(bnd1, GMT.GItype) ? bnd1 : parent(bnd1))
end
else
return img
Expand Down
Loading