From 9262de0c7313dd313d0ef5567e197710095cb037 Mon Sep 17 00:00:00 2001 From: Mariana Kassien Date: Mon, 18 Sep 2023 12:52:48 -0400 Subject: [PATCH] new code for data download and filtering, updated folder structure --- .Rbuildignore | 4 +- NRTAPmodel.Rproj | 4 ++ R/.DS_Store | Bin 6148 -> 6148 bytes .../aqs_download_filter.R | 44 ++++++++++++++++++ .../download_aqs_data.R | 0 .../filter_minimum_poc.R | 0 6 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 R/data_download_preprocess/aqs_download_filter.R rename R/{data_download_functions => data_download_preprocess}/download_aqs_data.R (100%) rename R/{preprocessing => data_download_preprocess}/filter_minimum_poc.R (100%) diff --git a/.Rbuildignore b/.Rbuildignore index 13d4f111..aa62d510 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,2 +1,4 @@ ^\.github$ -tools/ \ No newline at end of file +tools/ +^.*\.Rproj$ +^\.Rproj\.user$ diff --git a/NRTAPmodel.Rproj b/NRTAPmodel.Rproj index 8e3c2ebc..21a4da08 100755 --- a/NRTAPmodel.Rproj +++ b/NRTAPmodel.Rproj @@ -11,3 +11,7 @@ Encoding: UTF-8 RnwWeave: Sweave LaTeX: pdfLaTeX + +BuildType: Package +PackageUseDevtools: Yes +PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/R/.DS_Store b/R/.DS_Store index ac2b5a6e646ef19b53c49a422ed80cfe609f9c03..92013ad87573e8b521c112cd5da096ec326698d3 100644 GIT binary patch delta 111 zcmZoMXfc@J&&awlU^g=(>tr4lXGV$10W7kD1q?+DsSF@8pCK8@DxO@!qKH%O6w67R SatBxwH + mutate(ID.Site = substr(ID.Monitor, 1, 17)) + +site_id="ID.Site" +poc_name="POC" + +# Filter sites with multiple POCs (select lowest-numbered POC per site) +data_filtered =filter_minimum_poc(input_df, site_id, poc_name) + +# Save new filtered data - wasn't sure what to name it so I added "filtered_" to the beginning. We can change that too if there's a better idea. +output_name=paste(directory_to_save, "filtered_",resolution_temporal, "_", parameter_code, "_", year_start, "-", year_end, ".csv", sep="") + # output_name + # [1] "./input/aqs/filtered_daily_88101_2018-2022.csv" +write.csv(data_filtered, output_name) diff --git a/R/data_download_functions/download_aqs_data.R b/R/data_download_preprocess/download_aqs_data.R similarity index 100% rename from R/data_download_functions/download_aqs_data.R rename to R/data_download_preprocess/download_aqs_data.R diff --git a/R/preprocessing/filter_minimum_poc.R b/R/data_download_preprocess/filter_minimum_poc.R similarity index 100% rename from R/preprocessing/filter_minimum_poc.R rename to R/data_download_preprocess/filter_minimum_poc.R