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

Fix tests broken by GEDI migration to LPCLOUD #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 6 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
branches: [master]
tags: ["*"]
pull_request:
# needed to allow julia-actions/cache to delete old caches that it has created
permissions:
actions: write
contents: read
jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand All @@ -12,7 +16,7 @@ jobs:
fail-fast: false
matrix:
version:
- "1.6"
- "lts"
- "1"
- "nightly"
os:
Expand All @@ -27,16 +31,7 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc_versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
ref: gh-pages
- uses: julia-actions/setup-julia@latest
with:
version: "1.7"
version: "lts"
- name: Install dependencies
run: julia -e 'using Pkg; Pkg.add("JSON")'
- name: Update versions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@latest
with:
version: "1.7"
version: "lts"
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
Expand Down
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "SpaceLiDAR"
uuid = "29bf0bfc-420f-4fa5-b441-811fd9e6e11d"
authors = ["Maarten Pronk", "Deltares"]
version = "0.4.0"
version = "0.4.1"

[deps]
AWSS3 = "1c724243-ef5b-51ab-93f4-b0a88ac62a95"
Expand Down Expand Up @@ -46,7 +46,7 @@ Statistics = "1"
TableOperations = "1.2"
Tables = "^1.4"
TimeZones = "1"
julia = "^1.6"
julia = "1.9"

[extras]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
2 changes: 1 addition & 1 deletion src/ICESat/GLAH06.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function points(
stop = findlast(ind)

if isnothing(start)
@warn "no data found within bbox of track $track in $(file.filename)"
@warn "no data found within bbox of $(file.filename)"

gt = (
longitude = Float64[],
Expand Down
10 changes: 5 additions & 5 deletions src/search.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function search(
before::Union{Nothing,DateTime} = nothing,
after::Union{Nothing,DateTime} = nothing,
id::Union{Nothing,String,Vector{String}} = nothing,
provider::String = "LPDAAC_ECS",
provider::String = "LPCLOUD",
)::Vector{GEDI_Granule}
startswith(string(product), prefix(m)) || throw(ArgumentError("Wrong product $product for $(mission(m)) mission."))
if bbox != world
Expand Down Expand Up @@ -217,7 +217,7 @@ end

function granule_info(item)::NamedTuple
filename = item.producer_granule_id
urls = filter(x -> get(x, "type", "") in ("application/x-hdf5", "application/x-hdfeos"), item.links)
urls = filter(x -> endswith(lowercase(get(x, "href", "")), ".h5"), item.links)

https = filter(u -> startswith(u.href, "http"), urls)
https_url = length(https) > 0 ? https[1].href : nothing
Expand All @@ -238,7 +238,7 @@ end
function granule_info_umm(item)::NamedTuple
# Schema is here: https://git.earthdata.nasa.gov/projects/EMFD/repos/unified-metadata-model/browse/granule/v1.6.4/umm-g-json-schema.json
rurls = item.umm.RelatedUrls
urls = filter(x -> get(x, "MimeType", "") in ("application/x-hdf5", "application/x-hdfeos"), rurls)
urls = filter(x -> endswith(lowercase(get(x, "URL", "")), ".h5"), rurls)

https = filter(u -> startswith(u.URL, "http"), urls)
https_url = length(https) > 0 ? https[1].URL : nothing
Expand All @@ -247,7 +247,7 @@ function granule_info_umm(item)::NamedTuple

filename = item.meta["native-id"]

(; filename, https_url = https_url, s3_url = s3_url)
(; filename, https_url, s3_url, polygons = [])
end

function earthdata_search(;
Expand Down Expand Up @@ -279,7 +279,7 @@ function earthdata_search(;
end

if !isnothing(id)
q["producer_granule_id"] = id
q["producer_granule_id"] = id
end

qurl = umm ? earthdata_url : replace(earthdata_url, "umm_json_v1_6_4" => "json")
Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ empty_extent = convert(Extent, empty_bbox)
@test length(granules) > 0
@test length(granules[1].polygons) > 0

id = "GEDI02_A_2023003040347_O22988_03_T06105_02_003_02_V002.h5";
id = "GEDI02_A_2023003040347_O22988_03_T06105_02_003_02_V002"
@test length(search(:GEDI, :GEDI02_A; version = 2, id = id)) == 1

@test_throws ArgumentError find(:ICESat2, "GLAH14")
Expand Down
Loading