diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c6f911b1..060f242e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -110,7 +110,7 @@ jobs: - name: Create Release if: github.event_name != 'pull_request' && steps.version.outputs.new_ver == 'TRUE' id: create_release - uses: zendesk/action-create-release@v1 + uses: zendesk/action-create-release@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/DataCleaningScripts/get_water_data.R b/DataCleaningScripts/get_water_data.R index b318aba3..34c0a18c 100644 --- a/DataCleaningScripts/get_water_data.R +++ b/DataCleaningScripts/get_water_data.R @@ -10,6 +10,10 @@ source("DataCleaningScripts/eden_covariates.R") get_eden_data <- function() { download_eden_depths() + +if(length(list.files("Water", pattern = "*_depth.nc"))==0) { + return(NULL) +} else { covariate_data <- read.table("Water/eden_covariates.csv", header = TRUE, sep = ",") new_covariates <- get_eden_covariates() %>% @@ -39,6 +43,7 @@ depth_data <- dplyr::filter(depth_data, !date %in% new_depths$date) %>% file.remove(dir(path=file.path('Water'), pattern="_.*_depth.nc", full.names = TRUE)) update_last_download(metadata = get_metadata()) +} return(list(covariate_data=covariate_data, depth_data=depth_data)) } @@ -50,12 +55,17 @@ return(list(covariate_data=covariate_data, depth_data=depth_data)) update_water <- function() { data <- get_eden_data() + + if(is.null(data)) { + return(cat("...No new data...")) + } else { write.table(data$covariate_data, "Water/eden_covariates.csv", row.names = FALSE, col.names = TRUE, na="", sep = ",", quote = FALSE) write.table(data$depth_data, file = "Water/eden_depth.csv", row.names = FALSE, col.names = TRUE, na = "", sep = ",", quote = FALSE) + } } #' Reads downloaded sophia.usgs gauge files