Skip to content

Commit

Permalink
add other possibe names for lon lat variables
Browse files Browse the repository at this point in the history
  • Loading branch information
miturbide committed May 1, 2020
1 parent 7ee0942 commit c093e99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/loadStationData.R
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ loadStationData <- function(dataset,
if (grepl("\\.ncml$|\\.nc$|\\.nc4$|", dataset)) {
stids <- nc$findVariable("station_id")
stids <- stids$read()
stids <- stids$make1DStringArray()
stids <- tryCatch({stids$make1DStringArray()}, error = function(err) {stids})
stids <- stids$copyToNDJavaArray()
} else {
# Reading stations from zip file
Expand All @@ -140,9 +140,13 @@ loadStationData <- function(dataset,
## Longitude and latitude
if (grepl("\\.ncml$|\\.nc$|\\.nc4$|", dataset)) {
lons <- nc$findVariable("lon")
if (is.null(lons)) lons <- nc$findVariable("Lon")
if (is.null(lons)) lons <- nc$findVariable("x")
lons <- lons$read()
lons <- lons$copyToNDJavaArray()
lats <- nc$findVariable("lat")
if (is.null(lats)) lats <- nc$findVariable("Lat")
if (is.null(lats)) lats <- nc$findVariable("y")
lats <- lats$read()
lats <- lats$copyToNDJavaArray()
}else{
Expand Down

0 comments on commit c093e99

Please sign in to comment.