Skip to content

Commit

Permalink
fixed a bug in the "vsi_time_specific_orbits_wkt()" function related to
Browse files Browse the repository at this point in the history
  • Loading branch information
mlampros committed Dec 14, 2023
1 parent 4963260 commit 536a8e2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: IceSat2R
Type: Package
Title: ICESat-2 Altimeter Data using R
Version: 1.0.5
Date: 2023-12-08
Date: 2023-12-14
Authors@R: c( person(given = "Lampros", family = "Mouselimis", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "https://orcid.org/0000-0002-8024-1546")), person("OpenAltimetry.org", role = "cph"))
Description: Programmatic connection to the 'OpenAltimetry API' <https://openaltimetry.org/data/swagger-ui/> to download and process 'ATL03' (Global Geolocated Photon Data), 'ATL06' (Land Ice Height), 'ATL07' (Sea Ice Height), 'ATL08' (Land and Vegetation Height), 'ATL10' (Sea Ice Freeboard), 'ATL12' (Ocean Surface Height) and 'ATL13' (Inland Water Surface Height) 'ICESat-2' Altimeter Data. The user has the option to download the data by selecting a bounding box from a 1- or 5-degree grid globally utilizing a shiny application. The 'ICESat-2' mission collects altimetry data of the Earth's surface. The sole instrument on 'ICESat-2' is the Advanced Topographic Laser Altimeter System (ATLAS) instrument that measures ice sheet elevation change and sea ice thickness, while also generating an estimate of global vegetation biomass. 'ICESat-2' continues the important observations of ice-sheet elevation change, sea-ice freeboard, and vegetation canopy height begun by 'ICESat' in 2003.
License: GPL-3
Expand Down
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* I renamed the Dockerfiles and I added a separate Dockerfile for the IceSatR package because the docker image didn't work due to the similar naming of the binder image. I also added (in the Dockerfiles) the "awscli" installation which is required for the vignettes. The ".github/workflows/docker_image.yml" file was adjusted as well.
* I updated the documentation to account for the migration of OpenAltimetry to EARTHDATA (https://openaltimetry.earthdatacloud.nasa.gov/)
* I updated the *getTracks()* function
* I fixed a bug in the *vsi_time_specific_orbits_wkt()* function


## IceSat2R 1.0.4
Expand Down
28 changes: 23 additions & 5 deletions R/mission_orbits.R
Original file line number Diff line number Diff line change
Expand Up @@ -1404,13 +1404,31 @@ vsi_time_specific_orbits_wkt = function(date_from,

if (length(idx_relev) > 0) {

if (length(idx_relev) == 1) {
dat_all = dat_all[[idx_relev]]
} else {
dat_all = dat_all[idx_relev] # the sublists 'dat_all' can return POINT, LINESTRING (cast all to POINT)
dat_all = data.table::rbindlist(dat_all)
dat_all = dat_all[idx_relev]

# I expect each sublist to be of type "sfc_POINT" and normally observations which are not (and can be for instance "sfc_LINESTRING") won't have a description column either. Therefore use the next line for removal
descr_not_idx = which(as.vector(unlist(lapply(dat_all, function(x) {
colnams = colnames(x)
if ('description' %in% colnams) {
verify_descr = (is.na(x$description) | x$description == "")
}
else if ('Description' %in% colnams) {
verify_descr = (is.na(x$Description) | x$Description == "") # In Macintosh (osx) the "description" column appears with an upper case "D" as "Description", see the following issue: https://github.com/mlampros/IceSat2R/issues/9#issuecomment-1152020607
}
else {
stop("The 'D(d)escription' column must exist in every sublist!", call. = F)
}
verify_descr
}))))

LEN_exc = length(descr_not_idx)
if (LEN_exc > 0) {
if (verbose) message(glue::glue("{LEN_exc} output sublist did not have a valid 'description' and will be removed!"))
dat_all = dat_all[-descr_not_idx]
}

dat_all = data.table::rbindlist(dat_all)

if (nrow(dat_all) > 0) {
dat_all
}
Expand Down

0 comments on commit 536a8e2

Please sign in to comment.