Skip to content
Snippets Groups Projects
Commit 339121e5 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

log: Add debug logging

parent 55b8267b
No related branches found
No related tags found
No related merge requests found
...@@ -362,6 +362,8 @@ def create_matrix(): ...@@ -362,6 +362,8 @@ def create_matrix():
def create_WHS_WH(time): def create_WHS_WH(time):
logging.info(f"Create WHS_WH for {time}")
for j in range(5): for j in range(5):
subprocess.run( subprocess.run(
f"cdo -O -chname,WVD,WVDLastHour -selname,WVD -seltimestep,{str(time+j+1)} {tmpfile_path}prepare_WHS.nc {tmpfile_path}WVD_LastHourtmp.nc", f"cdo -O -chname,WVD,WVDLastHour -selname,WVD -seltimestep,{str(time+j+1)} {tmpfile_path}prepare_WHS.nc {tmpfile_path}WVD_LastHourtmp.nc",
...@@ -459,6 +461,7 @@ def create_WHS_WH(time): ...@@ -459,6 +461,7 @@ def create_WHS_WH(time):
def create_VRS(time): def create_VRS(time):
logging.info("Create VRS")
subprocess.run( subprocess.run(
f'cdo -aexpr,"RTA=(((Q0-Q0LastHour)>7)?1:0)+((WVD-WVDLastHour)>=15?1:0);IRTA=(1-(BT/80));SFRS=((1-(Q0-270)/540)/1.5);" {tmpfile_path}this_hour.nc {tmpfile_path}this_hr.nc', f'cdo -aexpr,"RTA=(((Q0-Q0LastHour)>7)?1:0)+((WVD-WVDLastHour)>=15?1:0);IRTA=(1-(BT/80));SFRS=((1-(Q0-270)/540)/1.5);" {tmpfile_path}this_hour.nc {tmpfile_path}this_hr.nc',
shell=True, shell=True,
...@@ -471,6 +474,7 @@ def create_VRS(time): ...@@ -471,6 +474,7 @@ def create_VRS(time):
def create_TSSH_VAS(time): def create_TSSH_VAS(time):
logging.info("Create TSSH_VAS")
subprocess.run( subprocess.run(
f'cdo -O -aexpr,"TSSH=((HH1==1)?HH2*(TSSHLastHour+TM):HH2*0.75*TSSHLastHour);SPH=((TSSH>87)?1:0);VAS=((VASLastHour*0.95*(1-((WVD-220)/6000))+SPH)/(1+0.3*RR))" {tmpfile_path}this_hour.nc {tmpfile_path}this_hour_tmp.nc', f'cdo -O -aexpr,"TSSH=((HH1==1)?HH2*(TSSHLastHour+TM):HH2*0.75*TSSHLastHour);SPH=((TSSH>87)?1:0);VAS=((VASLastHour*0.95*(1-((WVD-220)/6000))+SPH)/(1+0.3*RR))" {tmpfile_path}this_hour.nc {tmpfile_path}this_hour_tmp.nc',
shell=True, shell=True,
...@@ -487,6 +491,7 @@ def create_HH1_HH2(time): ...@@ -487,6 +491,7 @@ def create_HH1_HH2(time):
def create_saturation(): def create_saturation():
logging.info("Create saturation")
# This is fixed for all hours and should be available in the background data # This is fixed for all hours and should be available in the background data
expr = "aexpr,SP=(0.61078*exp(17.269*TM/(TM+237.3)))" expr = "aexpr,SP=(0.61078*exp(17.269*TM/(TM+237.3)))"
cdo_command = [ cdo_command = [
...@@ -499,6 +504,7 @@ def create_saturation(): ...@@ -499,6 +504,7 @@ def create_saturation():
def create_pressure(): def create_pressure():
logging.info("Create pressure")
# This is fixed for all hours and should be available in the background data # This is fixed for all hours and should be available in the background data
expr = "aexpr,PP=UM*SP/100" expr = "aexpr,PP=UM*SP/100"
cdo_command = [ cdo_command = [
...@@ -512,6 +518,7 @@ def create_pressure(): ...@@ -512,6 +518,7 @@ def create_pressure():
def create_wvd(): def create_wvd():
logging.info("Create wvd")
# This is fixed for all hours and should be available in the background data # This is fixed for all hours and should be available in the background data
expr = "aexpr,WVD=(SP-PP)*1000" expr = "aexpr,WVD=(SP-PP)*1000"
cdo_command = [ cdo_command = [
...@@ -526,7 +533,7 @@ def create_wvd(): ...@@ -526,7 +533,7 @@ def create_wvd():
def create_BT(): def create_BT():
# BT is not available in the dataset and need to be calculted and added to background_data.nc # BT is not available in the dataset and need to be calculted and added to background_data.nc
logging.info("Create BT")
expr = "aexpr,BT=((RR > 0 || (((100-UM)/100)*6.112*exp(17.67*TM/(TM+243.5))) < 2)) ? 60 : 0" expr = "aexpr,BT=((RR > 0 || (((100-UM)/100)*6.112*exp(17.67*TM/(TM+243.5))) < 2)) ? 60 : 0"
cdo_command = [ cdo_command = [
"cdo", "cdo",
...@@ -540,6 +547,7 @@ def create_BT(): ...@@ -540,6 +547,7 @@ def create_BT():
def prepare_WHS(): def prepare_WHS():
# system("cdo selname,RR,BT,WVD background_data.nc prepareWHS.nc") # system("cdo selname,RR,BT,WVD background_data.nc prepareWHS.nc")
logging.info("Prepare WHS")
my_variables = ["TM", "RR", "BT", "WVD"] my_variables = ["TM", "RR", "BT", "WVD"]
variable_list = ",".join(my_variables) variable_list = ",".join(my_variables)
cdo_command = [ cdo_command = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment