Skip to content

Commit b37ff50

Browse files
committed
Use a dict with hardcoded file names in weka-hills example
1 parent 40c54a2 commit b37ff50

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

examples/nz_weka_hills_leapfrog/nz_weka_hills_leapfrog_to_brgi_geodb.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ def _():
2020
from bedrock_ge.gi.write import write_brgi_db_to_file
2121
from bedrock_ge.gi.io_utils import geodf_to_df
2222
from pyproj import CRS
23+
from pathlib import Path
2324
return (
2425
BedrockGIMapping,
2526
CRS,
2627
InSituTestTableMapping,
2728
LocationTableMapping,
29+
Path,
2830
ProjectTableMapping,
2931
create_brgi_geodb,
3032
map_to_brgi_db,
@@ -59,7 +61,20 @@ def _(mo):
5961
if (file.is_file() and file.suffix.lower() == ".csv")
6062
]
6163
gi_csvs
62-
return gi_csvs, nb_dir
64+
return (nb_dir,)
65+
66+
67+
@app.cell
68+
def _(Path):
69+
csv_files = {
70+
"cpt_collar": Path("WH_cpt_collar.csv"),
71+
"spt_all": Path("WH_SPT_all.csv"),
72+
"collar_all": Path("WH_collar_all.csv"),
73+
"geol_all": Path("WH_Geol_all.csv"),
74+
"cpt_alluvial": Path("WH_cpt_Alluvial.csv"),
75+
"survey_all": Path("WH_survey_all.csv")
76+
}
77+
return (csv_files,)
6378

6479

6580
@app.cell(hide_code=True)
@@ -69,23 +84,29 @@ def _(mo):
6984

7085

7186
@app.cell
72-
def _(gi_csvs, nb_dir, pd):
73-
bh_inclination_df = pd.read_csv(nb_dir / gi_csvs[5])
87+
def _(csv_files, nb_dir, pd):
88+
bh_inclination_df = pd.read_csv(nb_dir / csv_files["survey_all"])
7489
bh_inclination_df["Inclination"].unique()
7590
return
7691

7792

7893
@app.cell
79-
def _(gi_csvs, nb_dir, pd):
80-
bh_location_df = pd.read_csv(nb_dir / gi_csvs[0])
81-
cpt_data_df = pd.read_csv(nb_dir / gi_csvs[1])
82-
cpt_location_df = pd.read_csv(nb_dir / gi_csvs[2])
83-
geol_df = pd.read_csv(nb_dir / gi_csvs[3])
84-
spt_df = pd.read_csv(nb_dir / gi_csvs[4])
94+
def _(csv_files, nb_dir, pd):
95+
bh_location_df = pd.read_csv(nb_dir / csv_files["collar_all"])
96+
cpt_data_df = pd.read_csv(nb_dir / csv_files["cpt_alluvial"])
97+
cpt_location_df = pd.read_csv(nb_dir / csv_files["cpt_collar"] )
98+
geol_df = pd.read_csv(nb_dir / csv_files["geol_all"])
99+
spt_df = pd.read_csv(nb_dir / csv_files["spt_all"])
85100
spt_df
86101
return bh_location_df, geol_df, spt_df
87102

88103

104+
@app.cell
105+
def _(bh_location_df):
106+
bh_location_df.columns
107+
return
108+
109+
89110
@app.cell
90111
def _(
91112
BedrockGIMapping,

0 commit comments

Comments
 (0)