Skip to content

Commit dd27063

Browse files
committed
templated camels attrs, but not yet daymet
1 parent 81b3ae2 commit dd27063

8 files changed

Lines changed: 107 additions & 50 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ output/
2828
old_dataset_dirs.tar.gz
2929
old_logs
3030
eml/data_links
31+
eml/eml_out
Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
attributeName attributeDefinition class unit dateTimeFormatString missingValueCode missingValueCodeExplanation
2-
p_mean numeric !Add units here!
3-
pet_mean numeric !Add units here!
4-
aridity numeric !Add units here!
5-
p_seasonality numeric !Add units here!
6-
frac_snow numeric !Add units here!
7-
high_prec_freq numeric !Add units here!
8-
high_prec_dur numeric !Add units here!
9-
high_prec_timing categorical
10-
low_prec_freq numeric !Add units here!
11-
low_prec_dur numeric !Add units here!
12-
low_prec_timing categorical
13-
site_code character
14-
geol_1st_class categorical
15-
glim_1st_class_frac numeric !Add units here!
16-
geol_2nd_class categorical
17-
glim_2nd_class_frac numeric !Add units here!
18-
carbonate_rocks_frac numeric !Add units here!
19-
geol_porosity numeric !Add units here!
20-
geol_permeability numeric !Add units here!
21-
sand_frac numeric !Add units here!
22-
silt_frac numeric !Add units here!
23-
clay_frac numeric !Add units here!
24-
organic_frac numeric !Add units here!
25-
gauge_lat numeric !Add units here!
26-
gauge_lon numeric !Add units here!
27-
area numeric !Add units here!
28-
elev_mean numeric !Add units here!
29-
slope_mean numeric !Add units here!
30-
frac_forest numeric !Add units here!
31-
dom_land_cover_frac numeric !Add units here!
32-
dom_land_cover categorical
33-
root_depth_50 numeric !Add units here!
34-
root_depth_99 numeric !Add units here!
1+
"attributeName" "attributeDefinition" "class" "unit" "dateTimeFormatString" "missingValueCode" "missingValueCodeExplanation"
2+
"site_code" "Short name for MacroSheds site. See https://docs.google.com/spreadsheets/d/1Xd38tvB0upHjDRDa5qalGN2Ors6HHWZKpT4Bw0dDqU4/edit#gid=0" "character"
3+
"p_mean" "mean daily precipitation 1989-10-01 to 2009-09-30 (Daymet)" "numeric" "millimeterPerDay" "NA" "missing value"
4+
"pet_mean" "mean daily PET (estimated using Priestley-Taylor formulation with gridded alpha product from Aschonitis et al. 2017) (Daymet)" "numeric" "millimeterPerDay" "NA" "missing value"
5+
"aridity" "aridity (ratio of pet_mean to p_mean) (Daymet)" "numeric" "dimensionless" "NA" "missing value"
6+
"p_seasonality" "seasonality and timing of precipitation (estimated using sine curves to represent the annual temperature and preciptiation cycles, positive [negative] values indicate that precipitation peaks in summer [winter], values close to 0 indicate uniform precipitation throughout the year) (Daymet)" "numeric" "dimensionless" "NA" "missing value"
7+
"frac_snow" "fraction of precipitation falling as snow (i.e., on days colder than 0°C) (Daymet)" "numeric" "dimensionless" "NA" "missing value"
8+
"high_prec_freq" "frequency of high precipitation days ( >= 5 times mean daily precipitation) (Daymet)" "numeric" "daysPerYear" "NA" "missing value"
9+
"high_prec_dur" "average duration of high precipitation events (number of consecutive days >= 5 times mean daily precipitation) (Daymet)" "numeric" "day" "NA" "missing value"
10+
"high_prec_timing" "season during which most high precipitation days ( >= 5 times mean daily precip.) occur (Daymet)" "categorical" "NA" "missing value"
11+
"low_prec_freq" "frequency of dry days ( <1 mm/day) (Daymet)" "numeric" "daysPerYear" "NA" "missing value"
12+
"low_prec_dur" "average duration of dry periods (number of consecutive days <1 mm/day) (Daymet)" "numeric" "day" "NA" "missing value"
13+
"low_prec_timing" "season during which most dry days ( <1 mm/day) occur (Daymet)" "categorical" "NA" "missing value"
14+
"geol_1st_class" "most common geologic class in the catchment (GLiM)" "categorical" "NA" "missing value"
15+
"glim_1st_class_frac" "fraction of the catchment area associated with its most common geologic class (GLiM)" "numeric" "dimensionless" "NA" "missing value"
16+
"geol_2nd_class" "2nd most common geologic class in the catchment (GLiM)" "categorical" "NA" "missing value"
17+
"glim_2nd_class_frac" "fraction of the catchment area associated with its 2nd most common geologic class (GLiM)" "numeric" "dimensionless" "NA" "missing value"
18+
"carbonate_rocks_frac" "fraction of the catchment area characterized as ""Carbonate sedimentary rocks"" (GLiM)" "numeric" "dimensionless" "NA" "missing value"
19+
"geol_porosity" "subsurface porosity (GLHYMPS)" "numeric" "dimensionless" "NA" "missing value"
20+
"geol_permeability" "subsurface permeability (log10) (GLHYMPS)" "numeric" "squareMeter" "NA" "missing value"
21+
"sand_frac" "sand fraction (of the soil material smaller than 2 mm, layers marked as oragnic material, water, bedrock and ""other"" were excluded) (gSSURGO)" "numeric" "percent" "NA" "missing value"
22+
"silt_frac" "silt fraction (of the soil material smaller than 2 mm, layers marked as oragnic material, water, bedrock and ""other"" were excluded) (gSSURGO)" "numeric" "percent" "NA" "missing value"
23+
"clay_frac" "clay fraction (of the soil material smaller than 2 mm, layers marked as oragnic material, water, bedrock and ""other"" were excluded) (gSSURGO)" "numeric" "percent" "NA" "missing value"
24+
"organic_frac" "fraction of soil_depth_statsgo marked as organic material (class 13) (gSSURGO)" "numeric" "percent" "NA" "missing value"
25+
"gauge_lat" "gauge latitude " "numeric" "degreesNorth" "NA" "missing value"
26+
"gauge_lon" "gauge longitude" "numeric" "degreesEast" "NA" "missing value"
27+
"area" "watershed area" "numeric" "squareKilometers" "NA" "missing value"
28+
"elev_mean" "watershed mean elevation" "numeric" "meter" "NA" "missing value"
29+
"slope_mean" "watershed mean slope" "numeric" "metersPerKilometer" "NA" "missing value"
30+
"frac_forest" "forest fraction" "numeric" "!Add units here!" "NA" "missing value"
31+
"dom_land_cover_frac" "fraction of the catchment area associated with the dominant land cover" "numeric" "dimensionless" "NA" "missing value"
32+
"dom_land_cover" "dominant land cover type (Noah-modified 20-category IGBP-MODIS land cover)" "categorical" "NA" "missing value"
33+
"root_depth_50" "root depth (percentile 50% extracted from a root depth distribution based on IGBP land cover) (MODIS)" "numeric" "meter" "NA" "missing value"
34+
"root_depth_99" "root depth (percentile 99% extracted from a root depth distribution based on IGBP land cover) (MODIS)" "numeric" "meter" "NA" "missing value"

eml/eml_templates/attributes_EB.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
"attributeName" "attributeDefinition" "class" "unit" "dateTimeFormatString" "missingValueCode" "missingValueCodeExplanation"
2+
"datetime" "date and time in UTC" "Date" "Y-M-D h:m:s"
3+
"site_code" "Short name for MacroSheds site. See https://docs.google.com/spreadsheets/d/1Xd38tvB0upHjDRDa5qalGN2Ors6HHWZKpT4Bw0dDqU4/edit#gid=0" "character"
4+
"var" "variable name and prefix. See variable prefix metadata" "character"
5+
"val" "data value. See see https://docs.google.com/spreadsheets/d/1zc1RydnVyAQBdrp-6wBuZl8-gemgIro5893czoGM7mw/edit?usp=sharing for units" "numeric" "variable_unit" "NA" "missing value"
6+
"ms_status" "0 = clean value. 1 = questionable value" "numeric" "dimensionless"
7+
"ms_interp" "0 = measured or imputed by primary source. 1 = interpolated by MacroSheds" "numeric" "dimensionless"
8+
"val_err" "Uncertainty. See “Detection Limits and Uncertainty” section of https://eartharxiv.org/repository/view/3499/" "numeric" "variable_unit" "NA" "missing value"
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
attributeName attributeDefinition class unit dateTimeFormatString missingValueCode missingValueCodeExplanation
2-
network categorical
3-
domain categorical
4-
site_code categorical
5-
var categorical
6-
date Date !Add datetime specifier here!
7-
val numeric !Add units here!
8-
pctCellErr numeric !Add units here!
1+
"attributeName" "attributeDefinition" "class" "unit" "dateTimeFormatString" "missingValueCode" "missingValueCodeExplanation"
2+
"network" "Short name for MacroSheds network. See https://docs.google.com/spreadsheets/d/1Xd38tvB0upHjDRDa5qalGN2Ors6HHWZKpT4Bw0dDqU4/edit#gid=0 " "character"
3+
"domain" "Short name for MacroSheds domain. See https://docs.google.com/spreadsheets/d/1Xd38tvB0upHjDRDa5qalGN2Ors6HHWZKpT4Bw0dDqU4/edit#gid=0" "character"
4+
"site_code" "Short name for MacroSheds site. See https://docs.google.com/spreadsheets/d/1Xd38tvB0upHjDRDa5qalGN2Ors6HHWZKpT4Bw0dDqU4/edit#gid=0" "character"
5+
"var" "variable name and prefix. See variable prefix metadata" "character"
6+
"date" "date" "Date" "Y-M-D"
7+
"val" "data value. See see https://docs.google.com/spreadsheets/d/1zc1RydnVyAQBdrp-6wBuZl8-gemgIro5893czoGM7mw/edit?usp=sharing for units" "numeric" "variable_unit" "NA" "missing value"
8+
"pctCellErr" "The percentage of raster cells within the watershed for which no data were available. This includes both implicit (nothing reported for a particular cell) and explicit (""missing data"" code) values. MacroSheds does not report pctCellErr for products retrieved from Google Earth Engine, but we may in a future version." "numeric" "percent" "NA" "missing value"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
"attributeName" "code" "definition"
2+
"dom_land_cover" "Barren" "Barren"
3+
"dom_land_cover" "Closed Shrublands" "Closed Shrublands"
4+
"dom_land_cover" "Croplands" "Croplands"
5+
"dom_land_cover" "Deciduous Broadleaf Forests" "Deciduous Broadleaf Forests"
6+
"dom_land_cover" "Evergreen Needleleaf Forests" "Evergreen Needleleaf Forests"
7+
"dom_land_cover" "Grasslands" "Grasslands"
8+
"dom_land_cover" "Mixed Forests" "Mixed Forests"
9+
"dom_land_cover" "Open Shrublands" "Open Shrublands"
10+
"dom_land_cover" "Savannas" "Savannas"
11+
"dom_land_cover" "Urban and Built-up Lands" "Urban and Built-up Lands"
12+
"dom_land_cover" "Woody Savannas" "Woody Savannas"
13+
"geol_1st_class" "Acid Plutonic Rocks" "Acid Plutonic Rocks"
14+
"geol_1st_class" "Acid Volcanic Rocks" "Acid Volcanic Rocks"
15+
"geol_1st_class" "Basic Plutonic Rocks" "Basic Plutonic Rocks"
16+
"geol_1st_class" "Basic Volvanic Rocks" "Basic Volvanic Rocks"
17+
"geol_1st_class" "Carbonate Sedimentary Rocks" "Carbonate Sedimentary Rocks"
18+
"geol_1st_class" "Intermediate Plutonic Rock" "Intermediate Plutonic Rock"
19+
"geol_1st_class" "Intermediate Volcanic Rock" "Intermediate Volcanic Rock"
20+
"geol_1st_class" "Metamorphic Rocks" "Metamorphic Rocks"
21+
"geol_1st_class" "Mixed Sedimentary Rocks" "Mixed Sedimentary Rocks"
22+
"geol_1st_class" "Pyroclastics" "Pyroclastics"
23+
"geol_1st_class" "Siliciclasstic Sedimentary Rock" "Siliciclasstic Sedimentary Rock"
24+
"geol_1st_class" "Unconcolidated Sediments" "Unconcolidated Sediments"
25+
"geol_2nd_class" "Acid Plutonic Rocks" "Acid Plutonic Rocks"
26+
"geol_2nd_class" "Acid Volcanic Rocks" "Acid Volcanic Rocks"
27+
"geol_2nd_class" "Basic Plutonic Rocks" "Basic Plutonic Rocks"
28+
"geol_2nd_class" "Basic Volvanic Rocks" "Basic Volvanic Rocks"
29+
"geol_2nd_class" "Carbonate Sedimentary Rocks" "Carbonate Sedimentary Rocks"
30+
"geol_2nd_class" "Intermediate Volcanic Rock" "Intermediate Volcanic Rock"
31+
"geol_2nd_class" "Metamorphic Rocks" "Metamorphic Rocks"
32+
"geol_2nd_class" "Mixed Sedimentary Rocks" "Mixed Sedimentary Rocks"
33+
"geol_2nd_class" "Pyroclastics" "Pyroclastics"
34+
"geol_2nd_class" "Siliciclasstic Sedimentary Rock" "Siliciclasstic Sedimentary Rock"
35+
"geol_2nd_class" "Unconcolidated Sediments" "Unconcolidated Sediments"
36+
"high_prec_timing" "djf" "winter (December, January, February)"
37+
"high_prec_timing" "jja" "summer (June, July, August)"
38+
"high_prec_timing" "mam" "spring (March, April, May)"
39+
"high_prec_timing" "son" "fall (September, October, November)"
40+
"low_prec_timing" "djf" "winter (December, January, February)"
41+
"low_prec_timing" "jja" "summer (June, July, August)"
42+
"low_prec_timing" "mam" "spring (March, April, May)"
43+
"low_prec_timing" "son" "fall (September, October, November)"

eml/eml_templates/custom_units.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ kilogramsCarbonPerSquareMeter arealMassDensity kilogramsPerSquareMeter 1 kg*C/m^
33
micrometerPerSecond speed meterPerSecond 0.000001 ug/S
44
dayOfYear dimensionless number 1 numeric day of calendar year
55
variable_unit dimensionless number 1 units vary. see https://docs.google.com/spreadsheets/d/1zc1RydnVyAQBdrp-6wBuZl8-gemgIro5893czoGM7mw/edit?usp=sharing for units
6+
metersPerKilometer m/km
7+
daysPerYear
8+
day time second 86400
9+
degreesNorth
10+
degreesEast

src/global/global_helpers.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10374,6 +10374,14 @@ prepare_for_figshare <- function(where, dataset_version){
1037410374
file.path(where, '1_watershed_attribute_data'))
1037510375
file.rename(file.path(where, 'macrosheds_timeseries_data'),
1037610376
file.path(where, '2_timeseries_data'))
10377+
10378+
#clean up camels-style data
10379+
read_csv(file.path(where, '3_CAMELS-compliant_watershed_attributes/CAMELS_compliant_ws_attr.csv')) %>%
10380+
relocate('site_code', .before = p_mean) %>%
10381+
filter(! grepl('[0-9]{8}', site_code)) %>%
10382+
arrange(site_code) %>%
10383+
write_csv(file.path(where, '3_CAMELS-compliant_watershed_attributes/CAMELS_compliant_ws_attr.csv'))
10384+
1037710385
}
1037810386

1037910387
convert_ts_feathers_to_csv <- function(where){

0 commit comments

Comments
 (0)