@@ -207,7 +207,7 @@ files_to_link <- c(ts_tables,
207207basenames <- basename(files_to_link )
208208basenames <- sub(' ^0[1-9][a-z]?_' , ' ' , basenames )
209209basenames <- sub(' site_metadata' , ' sites' , basenames )
210- basenames <- sub(' timeseries_variable_metadata' , ' variables_time_series ' , basenames )
210+ basenames <- sub(' timeseries_variable_metadata' , ' variables_timeseries ' , basenames )
211211basenames <- sub(' ws_attr_variable_metadata' , ' variables_ws_attr_timeseries' , basenames )
212212basenames <- sub(' ws_attr_variable_category_codes' , ' variable_category_codes_ws_attr' , basenames )
213213basenames <- 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')
221221descriptions <- basenames
222222descriptions <- 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 ' )
225225descriptions <- str_replace(descriptions ,
226226 ' ^ws_attr_summaries\\ .csv$' ,
227227 ' Watershed attribute data, summarized across time, for all domains' )
228228descriptions <- 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 ' )
231231descriptions <- 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' )
240240descriptions <- str_replace(descriptions ,
241- ' ^variables_time_series \\ .csv$' ,
241+ ' ^variables_timeseries \\ .csv$' ,
242242 ' Time-series variable metadata (standard units, etc.)' )
243243descriptions <- 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' )
264264descriptions <- 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.' )
267267descriptions <- 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' )))
277278sw(file.remove(file.path(dd , ' attribution_and_intellectual_rights_ts.xlsx' )))
278279file.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' )
281282sw(file.remove(file.path(dd , ' data_use_agreements.docx' )))
282283file.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
331332setwd(' ../..' )
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
344358template_table_attributes(wd , dd , ' CAMELS_compliant_ws_attr_summaries.csv' )
345359template_table_attributes(wd , dd , ' CAMELS_compliant_Daymet_forcings.csv' )
346360template_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' )
348362template_table_attributes(wd , dd , ' range_check_limits.csv' )
349363template_table_attributes(wd , dd , ' detection_limits.csv' )
350364template_table_attributes(wd , dd , ' variables_ws_attr_timeseries.csv' )
@@ -354,6 +368,7 @@ template_table_attributes(wd, dd, 'data_irregularities.csv')
354368template_table_attributes(wd , dd , ' disturbance_record.csv' )
355369template_table_attributes(wd , dd , ' attribution_and_intellectual_rights_ws_attr.csv' )
356370template_table_attributes(wd , dd , ' data_coverage_breakdown.csv' )
371+ template_table_attributes(wd , dd , ' variable_sample_regimen_codes_timeseries.csv' )
357372
358373template_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