Skip to content
Snippets Groups Projects
Commit 9a4cc4d0 authored by Alexander Hinz's avatar Alexander Hinz
Browse files

dendro: adjustments for better code and correction in Snakefile

parent 90b40081
No related branches found
No related tags found
3 merge requests!31Dendro,!28Dendro,!23Major rework of the entire pipeline
This commit is part of merge request !28. Comments created here will be created in the context of that merge request.
......@@ -161,10 +161,10 @@ rule quicklook:
output: touch("{path}/{station_key}-quicklook")
shell: "python {pythonflags} -m plotting.do_plot_current_level1_soilnet --fail --station {wildcards.station_key} --ndays 15"
rule calculateStorage:
input: "{path}/{station_key}-{soilnet_key}-level2"
output: touch("{path}/{station_key}-{soilnet_key}-aggregate")
shell: "python {pythonflags} -m level2.do_dendro_calculation --station HH --device BC1 BC2 BC3 T5 --doall"
rule calculateDendro:
input: "{path}/{station_key}-{meteo_key}-level2"
output: touch("{path}/{station_key}-derived-dendro")
shell: "python {pythonflags} -m level1.do_dendro_calculation --station HH --device BC1 BC2 BC3 T5 --doall"
  • Maintainer

    As none of BC1, BC2, BC3 and T5 are currently processed at the VM we need to integrate a caching job here:

        input: 
            "{path}/{station_key}-{meteo_key}-level2",
            "{path}/HH-BC1-cache",
            "{path}/HH-BC1-cache",
            "{path}/HH-BC2-cache",
            "{path}/HH-BC3-cache",
            "{path}/HH-T5-cache",
        output: touch("{path}/{station_key}-derived-dendro")
        shell: "python {pythonflags} -m level1.do_dendro_calculation --station HH --device BC1 BC2 BC3 T5 --doall"
  • Please register or sign in to reply
# NOTE: will be obsolete when HH is moved
......
......@@ -25,7 +25,7 @@ def filter(data, flags):
return data[data.columns[data.columns.str.match(".*dendro(?!.*r)")]]
def grouper(df, n, fillvalue=None):
def grouper(df, n=3, fillvalue=None):
"""
This grouper function splits a pd.DataFrame into pd.DataFrames with `n` columns.
......@@ -39,7 +39,7 @@ def grouper(df, n, fillvalue=None):
def fillNa(df):
for bhd_value, bhd_manu, flag in grouper(df, n=3):
for bhd_value, bhd_manu, flag in grouper(df):
# setting 91 flag on all values, where calculated value is nan
df.loc[df[bhd_value].isna(), flag] = 91
df[bhd_value] = df[bhd_value].fillna(df[bhd_manu])
......@@ -182,7 +182,7 @@ def main(station, device, start_date, end_date, debug):
# corrections in index Order and not setted flags
final = final.sort_index()
for a, b, c in grouper(final, n=3):
for a, b, c in grouper(final):
final = final.fillna({a: NODATA, b: NODATA, c: 92})
writeData(final, device)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment