Skip to content

Commit

Permalink
polish...
Browse files Browse the repository at this point in the history
  • Loading branch information
brasmus committed Nov 4, 2024
1 parent 8c76f97 commit e6d9ed7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion R/station.GHCND.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ meta.GHCND <- function(url='https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/ghcnd
if (verbose) print(Cntrs)
for (ic in rownames(Cntrs)) {
if (verbose) print(paste(ic,cntrcode$country[cntrcode$cntrcode==ic]))
country[cntrs==ic] <- cntrcode$country[cntrcode$cntrcode==ic]
country[cntrs==ic] <- trimws(cntrcode$country[cntrcode$cntrcode==ic])
}
if (verbose) print(table(country))
meta <- cbind(meta,country)
Expand Down
5 changes: 3 additions & 2 deletions R/subset.station.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ station.subset <- function(x,it=NULL,is=NULL,verbose=FALSE) {
#print(slat); print(range(lat(x)))
if (verbose) {
print('station.subset:')
print(sloc); print(slon); print(slat); print(salt); print(scntr); print(smin); print(sparam)
print(sloc); print(slon); print(slat); print(salt); print(scntr); print(snmin); print(sparam)
}
## REB 2021-08-19
#if (length(sloc)>0) sell <- is.element(tolower(loc(x)),tolower(sloc))
Expand All @@ -279,7 +279,7 @@ station.subset <- function(x,it=NULL,is=NULL,verbose=FALSE) {
if (salt < 0) selz <- (alt(x) <= abs(salt)) else
selz <- (alt(x) >= salt)
}
if (length(scntr)>0) selc <- is.element(tolower(cntr(x)),tolower(scntr))
if (length(scntr)>0) selc <- is.element(trimws(tolower(cntr(x))),tolower(scntr))
if (length(snmin)>0) selm <- apply(coredata(x),2,nval) > snmin
if (length(sparam)>0) selp <- is.element(tolower(attr(x,"variable")),tolower(sparam))
if (length(sstid)==2) seli <- (stid(x) >= min(sstid)) & (stid(x) <= max(sstid)) else
Expand All @@ -289,6 +289,7 @@ station.subset <- function(x,it=NULL,is=NULL,verbose=FALSE) {
if(length(sj)>0) selj <- is.element(seq(1,dim(x)[2]),sj)
##
is <- sell & selx & sely & selz & selc & seli & selm & selp & selF & selj
browser()
if (sum(is)==0) {warning('Returning empty station set'); return(NULL)}
##
## Need to make sure both it and is are same type: here integers for index rather than logical
Expand Down

0 comments on commit e6d9ed7

Please sign in to comment.