Skip to content

Commit 1d0750d

Browse files
committed
just need to check out Q and gSSURGO issues and rebuild
1 parent 725c863 commit 1d0750d

5 files changed

Lines changed: 36 additions & 13 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"attributeName" "attributeDefinition" "class" "unit" "dateTimeFormatString" "missingValueCode" "missingValueCodeExplanation"
2+
"sample_regimen_code" "Two capital letters designating the sample regimen of the corresponding variable. These letters appear as the first two characters in the prefix of all time-series variable codes within MacroSheds data files. The prefix is separated from the variable code by an underscore." "character"
3+
"definition" "The meaning of each two-letter combination. May be used for filtering." "character"

eml/eml_templates/attributes_variables_time_series.txt renamed to eml/eml_templates/attributes_variables_timeseries.txt

File renamed without changes.

src/acquisition_master.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ ms_globals <- c(ls(all.names = TRUE), 'ms_globals')
319319
dir.create('logs', showWarnings = FALSE)
320320

321321
## change string in line below to find row index of your desired domain
322-
## dmnrow <- which(network_domain$domain == 'loch_vale')
322+
dmnrow <- which(network_domain$domain == 'calhoun')
323323
for(dmnrow in 1:nrow(network_domain)){
324324

325325
# drop_automated_entries('.') #use with caution!
@@ -379,9 +379,14 @@ for(dmnrow in 1:nrow(network_domain)){
379379
domain = domain)
380380

381381
if(domain != 'mcmurdo'){
382+
382383
ms_general(network = network,
383384
domain = domain,
384-
get_missing_only = TRUE)
385+
get_missing_only = F,
386+
# general_prod_filter = NULL)
387+
general_prod_filter = c('prism_precip', 'prism_temp_mean', 'et_ref'))
388+
# general_prod_filter = c('prism_temp_mean', 'et_ref'))
389+
general_prod_filter = c('et_ref'))
385390
}
386391

387392
retain_ms_globals(ms_globals)

src/dev/gather_townhall_data.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ws1 = ws1 %>%
1515
catchment_area_ha = ws_area_ha,
1616
# mean_annual_precip_prism_mm = cc_mean_annual_precip,
1717
mean_annual_temp_C = cc_mean_annual_temp,
18-
mean_annual_aet_mm = ci_mean_annual_et)
18+
mean_annual_aet_mm = ck_mean_annual_et)
1919

2020
ws2 = ws2 %>%
2121
mutate(pet_mean = pet_mean * 365,

src/global/one-off/build_eml_templates.R

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ files_to_link <- c(ts_tables,
207207
basenames <- basename(files_to_link)
208208
basenames <- sub('^0[1-9][a-z]?_', '', basenames)
209209
basenames <- sub('site_metadata', 'sites', basenames)
210-
basenames <- sub('timeseries_variable_metadata', 'variables_time_series', basenames)
210+
basenames <- sub('timeseries_variable_metadata', 'variables_timeseries', basenames)
211211
basenames <- sub('ws_attr_variable_metadata', 'variables_ws_attr_timeseries', basenames)
212212
basenames <- sub('ws_attr_variable_category_codes', 'variable_category_codes_ws_attr', basenames)
213213
basenames <- sub('ws_attr_data_source_codes', 'variable_data_source_codes_ws_attr', basenames)
@@ -221,13 +221,13 @@ basenames <- c(basenames, 'attribution_and_intellectual_rights_ws_attr.csv')
221221
descriptions <- basenames
222222
descriptions <- str_replace(descriptions,
223223
'^timeseries_([a-z_]+)\\.csv$',
224-
'Time-series (streamflow, precip if available, chemistry) for domain: \\1')
224+
'Time-series (streamflow, precip if available, chemistry) for domain: \\1. See variables_timeseries.csv and variable_sample_regimen_codes_timeseries.csv')
225225
descriptions <- str_replace(descriptions,
226226
'^ws_attr_summaries\\.csv$',
227227
'Watershed attribute data, summarized across time, for all domains')
228228
descriptions <- str_replace(descriptions,
229229
'^ws_attr_timeseries\\.csv$',
230-
'Watershed attribute data, temporally explicit, for all domains')
230+
'Watershed attribute data, temporally explicit, for all domains. See variables_ws_attr_timeseries.csv, variable_category_codes_ws_attr.csv, and variable_data_source_codes_ws_attr.csv')
231231
descriptions <- str_replace(descriptions,
232232
'^CAMELS_compliant_ws_attr_summaries\\.csv$',
233233
'Watershed attribute data, temporally explicit, for all domains, and interoperable with the CAMELS dataset (https://ral.ucar.edu/solutions/products/camels)')
@@ -238,7 +238,7 @@ descriptions <- str_replace(descriptions,
238238
'^sites\\.csv$',
239239
'Stream site metadata')
240240
descriptions <- str_replace(descriptions,
241-
'^variables_time_series\\.csv$',
241+
'^variables_timeseries\\.csv$',
242242
'Time-series variable metadata (standard units, etc.)')
243243
descriptions <- str_replace(descriptions,
244244
'^range_check_limits\\.csv$',
@@ -263,7 +263,7 @@ descriptions <- str_replace(descriptions,
263263
'A register of known watershed experiments and significant natural disturbances')
264264
descriptions <- str_replace(descriptions,
265265
'^attribution_and_intellectual_rights_ws_attr\\.csv$',
266-
'Information about fair use of watershed attribute data. See also attribution_and_intellectual_rights_ts.xlsx.')
266+
'Information about fair use of watershed attribute data. See also attribution_and_intellectual_rights_timeseries.xlsx.')
267267
descriptions <- str_replace(descriptions,
268268
'^data_coverage_breakdown\\.csv$',
269269
'Number of observations, timespan of observation, by variable and site')
@@ -274,10 +274,11 @@ for(i in seq_along(files_to_link)){
274274
}
275275

276276
#link additional files that will be grouped under "other entities"
277+
sw(file.remove(file.path(dd, 'attribution_and_intellectual_rights_timeseries.xlsx')))
277278
sw(file.remove(file.path(dd, 'attribution_and_intellectual_rights_ts.xlsx')))
278279
file.link('macrosheds_figshare_v1/0_documentation_and_metadata/01b_attribution_and_intellectual_rights_complete.xlsx',
279-
file.path(dd, 'attribution_and_intellectual_rights_ts.xlsx'))
280-
message('manually remove the second and third sheets from attribution_and_intellectual_rights_ts.xlsx')
280+
file.path(dd, 'attribution_and_intellectual_rights_timeseries.xlsx'))
281+
message('manually remove the second and third sheets from attribution_and_intellectual_rights_timeseries.xlsx')
281282
sw(file.remove(file.path(dd, 'data_use_agreements.docx')))
282283
file.link('macrosheds_figshare_v1/0_documentation_and_metadata/01a_data_use_agreements.docx',
283284
file.path(dd, 'data_use_agreements.docx'))
@@ -331,6 +332,19 @@ zip('code_autodocumentation.zip', files = list.files('code_autodocumentation', f
331332
setwd('../..')
332333

333334

335+
# make one more file for sample regimen codes ####
336+
337+
reg_codes = tribble(~sample_regimen_code, ~definition,
338+
'IS', 'Sample collected by an Installed Sensor.',
339+
'GN', 'Sample collected by hand (Grab sample) without a sensor (Non-sensor), e.g. a water sample for lab analysis.',
340+
'IN', 'Sample collected via an Installed apparatus, though not with a sensor per se (Non-sensor). This is rare.',
341+
'GS', 'Sample collected by hand (Grab sample), using a handheld Sensor.')
342+
343+
write_csv(reg_codes, file.path(dd, 'variable_sample_regimen_codes_timeseries.csv'))
344+
345+
basenames = c(basenames, 'variable_sample_regimen_codes_timeseries.csv')
346+
descriptions = c(descriptions, 'Time-series sample regimen codes (the two-letter prefix on all time-series variable names)')
347+
334348
# generate eml templates. these need to be manually modified ####
335349

336350
#manually edit all files after running these lines
@@ -344,7 +358,7 @@ template_table_attributes(wd, dd, 'timeseries_hbef.csv') #this one needs to be m
344358
template_table_attributes(wd, dd, 'CAMELS_compliant_ws_attr_summaries.csv')
345359
template_table_attributes(wd, dd, 'CAMELS_compliant_Daymet_forcings.csv')
346360
template_table_attributes(wd, dd, 'sites.csv')
347-
template_table_attributes(wd, dd, 'variables_time_series.csv')
361+
template_table_attributes(wd, dd, 'variables_timeseries.csv')
348362
template_table_attributes(wd, dd, 'range_check_limits.csv')
349363
template_table_attributes(wd, dd, 'detection_limits.csv')
350364
template_table_attributes(wd, dd, 'variables_ws_attr_timeseries.csv')
@@ -354,6 +368,7 @@ template_table_attributes(wd, dd, 'data_irregularities.csv')
354368
template_table_attributes(wd, dd, 'disturbance_record.csv')
355369
template_table_attributes(wd, dd, 'attribution_and_intellectual_rights_ws_attr.csv')
356370
template_table_attributes(wd, dd, 'data_coverage_breakdown.csv')
371+
template_table_attributes(wd, dd, 'variable_sample_regimen_codes_timeseries.csv')
357372

358373
template_geographic_coverage(wd, dd, 'sites.csv',
359374
lat.col = 'latitude', lon.col = 'longitude',
@@ -407,15 +422,15 @@ make_eml(wd, dd, ed,
407422
data.table.quote.character = rep('"', length(basenames)),
408423
data.table.url = NULL,
409424
other.entity = c('shapefiles.zip',
410-
'attribution_and_intellectual_rights_ts.xlsx',
425+
'attribution_and_intellectual_rights_timeseries.xlsx',
411426
'data_use_agreements.docx',
412427
'timeseries_refs.bib',
413428
'ws_attr_refs.bib',
414429
'changelog.txt',
415430
'glossary.txt',
416431
'code_autodocumentation.zip'),
417432
other.entity.name = c('shapefiles.zip',
418-
'attribution_and_intellectual_rights_ts.xlsx',
433+
'attribution_and_intellectual_rights_timeseries.xlsx',
419434
'data_use_agreements.docx',
420435
'timeseries_refs.bib',
421436
'ws_attr_refs.bib',

0 commit comments

Comments
 (0)