diff --git a/SEPTREFHUM.py b/SEPTREFHUM.py index 34666017ec6abeb64feb1bd82e16496f9f3c8373..3e3d01f19e7df262ca1d79c45042d3f1e6456ee7 100755 --- a/SEPTREFHUM.py +++ b/SEPTREFHUM.py @@ -27,19 +27,17 @@ for file in weatherdata_files: # Concatenate daily files > one file with daily values -subprocess.run( - 'cdo -O mergetime %swh_*.nc %swh_daysum.nc' % (outfile_path, outfile_path), - shell=True - ) +subprocess.run('cdo -O mergetime %swh_*.nc %swh_daysum.nc' % (outfile_path, outfile_path), shell=True) + -# Add sum of WH_SUM[yesterday] + WH_SUM[today] + WH_SUM[tomorrow] +# Add sum of WH_DAYSUM[yesterday] + WH_DAYSUM[today] + WH_DAYSUM[tomorrow] into WHS[today] # timselsum skips every 3 steps when summing 3 timestemps, so we must # create three different files and then merge them subprocess.run('cdo timselsum,3,0 out/wh_daysum.nc out/wh_3daysum_tmp_0.nc', shell=True) subprocess.run('cdo timselsum,3,1 out/wh_daysum.nc out/wh_3daysum_tmp_1.nc', shell=True) subprocess.run('cdo timselsum,3,2 out/wh_daysum.nc out/wh_3daysum_tmp_2.nc', shell=True) -subprocess.run('cdo -mergetime out/wh_3daysum_tmp_*.nc out/wh_3daysum_tmp_merged.nc', shell=True) +subprocess.run('cdo -chname,WH_DAYSUM,WHS -mergetime out/wh_3daysum_tmp_*.nc out/wh_3daysum_tmp_merged.nc', shell=True) # the last timesteps are most likely wrong, due to lack of "tomorrows" when performing timselsum # To remove the last ones: @@ -57,7 +55,7 @@ subprocess.run('cdo -mergetime out/wh_3daysum_tmp_*.nc out/wh_3daysum_tmp_merged # 1696629600, 1696716000, # 1696716000, 1696716000; #} -# The difference [1] - [0] should be 172800 seconds = 47 hours +# The difference [1] - [0] should be 172800 seconds = 48 hours # Timesteps with [1] - [0] != 172800 should be discarded # Using netCDF4 to accomplish this @@ -76,3 +74,8 @@ wh_3daysum.close() number_of_timesteps_to_keep = len(time_bnds) - number_of_timesteps_to_remove subprocess.run('cdo -seltimestep,1/%s out/wh_3daysum_tmp_merged.nc out/wh_3daysum.nc' % number_of_timesteps_to_keep, shell=True) +# Classifying warning status for the WHS model +# WHS == 0 --> Grey +# 0 < WHS < 20 --> Green +# 20 <= WHS < 40 --> Orange +# 40 <= WHS --> Red