Skip to content

Commit 1193b98

Browse files
EliEli
authored andcommitted
Renamed some dropbox materials so that they will be together in parent directory. Lower cased "value" in incoming data.
1 parent f7b1553 commit 1193b98

3 files changed

Lines changed: 58 additions & 10 deletions

File tree

dms_datastore/config_data/daily_dropbox.yaml renamed to dms_datastore/config_data/dropbox_daily.yaml

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11

2+
modeling_data: //cnrastore-bdo/Modeling_Data
3+
dropbox_home: //cnrastore-bdo/Modeling_Data/repo_staging_auto/dropbox
4+
target_tz: "Etc/GMT+8" # Odd, but the correct one in POSIX/pandas for PST.
5+
target_tz_label: PST
6+
27
data:
8+
39
- name: daily
410
collect:
511
file_pattern: "{source}_{station_id}_{agency_id}_flow_{syear}_{eyear}.csv"
6-
#location: "//cnrastore-bdo/Modeling_Data/repo_staging_auto/daily/raw"
7-
location: ./raw
12+
location: "//cnrastore-bdo/Modeling_Data/repo_staging_auto/daily/raw"
813
recursive_search: false
914
reader: read_ts
1015
selector: value
@@ -18,7 +23,8 @@ data:
1823
subloc: default
1924
unit: ft^3/s
2025
freq: D
21-
time_zone: Etc/GMT+8
26+
time_zone: ${target_tz}
27+
time_zone_label: ${target_tz_label}
2228
latitude: registry_lookup
2329
longitude: registry_lookup
2430
projection_x_coordinate: registry_lookup
@@ -40,13 +46,54 @@ data:
4046
recent_years: 3
4147
p3: 0.15
4248
p10: 0.05
43-
49+
50+
# This recipe operates on the scraped website from EBMUD. One of the daily time series from populate_daily
51+
# will catch occasional updates from USGS. A third recipe is in
52+
- name: moke ebmud
53+
collect:
54+
file_pattern: "mokelumne_flow_*.csv"
55+
location: "${dropbox_home}/mokelumne"
56+
recursive_search: false
57+
reader: read_ts
58+
wildcard: time_shard
59+
selector: null
60+
metadata:
61+
station_id: wbr
62+
source: ebmud
63+
agency_id: registry_lookup
64+
agency: registry_lookup
65+
freq: D
66+
param: flow
67+
unit: ft^3/s
68+
subloc: default
69+
time_zone: ${target_tz}
70+
time_zone_label: ${target_tz_label}
71+
latitude: registry_lookup
72+
longitude: registry_lookup
73+
projection_x_coordinate: registry_lookup
74+
projection_y_coordinate: registry_lookup
75+
agency_lat: registry_lookup
76+
agency_lon: registry_lookup
77+
# Coordinates are auto-populated from the station registry.
78+
output:
79+
repo_name: daily_formatted
80+
staging:
81+
dir: ./staging
82+
write_args:
83+
float_format: "%.4f"
84+
reconcile:
85+
prefer: repo
86+
allow_new_series: true
87+
inspection:
88+
recent_years: 3
89+
p3: 0.15
90+
p10: 0.05
91+
4492

4593
- name: daily_cx2
4694
collect:
4795
file_pattern: "{source}_{station_id}_{agency_id}_kmdist_{syear}_{eyear}.csv"
48-
#location: "//cnrastore-bdo/Modeling_Data/repo_staging_auto/daily/raw"
49-
location: ./raw
96+
location: "//cnrastore-bdo/Modeling_Data/repo_staging_auto/daily/raw"
5097
recursive_search: false
5198
reader: read_ts
5299
selector: value

dms_datastore/config_data/dstore_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ variable_definitions: variables.csv
44
sublocations: station_subloc.csv
55
ncro_inventory: ncro_inventory_full.csv
66
daily_data_manifest: daily_data_manifest.csv
7-
daily_dropbox_spec: daily_dropbox.yaml
7+
dropbox_daily: dropbox_daily.yaml
88
file_deletion_list: non_15_min_files_checked.txt
99
compare_excepts_formatted: compare_excepts_formatted.txt
1010
des_rationalize_time_spec: des_rationalize_cfg.yaml

dms_datastore/dropbox_data.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,10 @@ def _maybe_rename_value_column(ts, splice_args):
354354
splice_args:
355355
rename: {old: new} # dict rename
356356
"""
357-
# Auto-normalize 'VALUE' -> 'value' for univariate series
358-
if "VALUE" in ts.columns and "value" not in ts.columns:
359-
ts = ts.rename(columns={"VALUE": "value"})
357+
# Auto-normalize any case variant of 'value' -> 'value' for univariate series
358+
value_cols = [c for c in ts.columns if c.lower() == "value" and c != "value"]
359+
if value_cols:
360+
ts = ts.rename(columns={c: "value" for c in value_cols})
360361

361362
if not splice_args:
362363
return ts

0 commit comments

Comments
 (0)