Skip to content
Snippets Groups Projects
Commit 41cd9f88 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Remove comments around code

parent c1ac9a2f
No related branches found
No related tags found
No related merge requests found
......@@ -33,7 +33,6 @@ out_path="out/"
utc_offset = "+02:00"
local_timezone = pytz.timezone("Europe/Oslo")
"""
# Calculate cumulated degree days above 5 degrees after 1st of April
# Remove all values before April 1st
......@@ -57,8 +56,6 @@ subprocess.run(f"cdo -maskregion,Norge_landomrader.csv {tmp_path}DD_unmasked.nc
# (A>0)*(A<=260)*2 + (A>260)*(A<=360)*3 + (A>360)*(A<=560)*4 + (A>560)*0
subprocess.run(f'cdo -aexpr,"WARNING_STATUS=(TM>0)*(TM<=260)*2 + (TM>260)*(TM<=360)*3 + (TM>360)*(TM<=560)*4 + (TM>560)*0" {tmp_path}DD.nc {tmp_path}result.nc', shell=True)
"""
# Split the combined file into daily .nc files again, with YYYY-MM-DD in the filename. Convert to corresponding GeoTIFF files
# Variables that needs discrete classification, must be integers in order for mapserver to work properly (Don't ask!)
# Since we need WARNING_STATUS to be discretely classified, we need to create a separate GeoTIFF file for it
......@@ -73,14 +70,13 @@ for timestep in timesteps:
print(f"{timestep_index}: {file_date}")
timestep_dates.append(file_date)
# We must delete the GeoTIFF file before merging
"""subprocess.run(f'rm {tmp_path}result_*{file_date}_lcc.tif', shell=True)
subprocess.run(f'rm {tmp_path}result_*{file_date}_lcc.tif', shell=True)
subprocess.run(f'rm {out_path}result_*{file_date}.tif', shell=True)
subprocess.run(f'gdal_translate -ot Int16 -of GTiff -b {timestep_index} NETCDF:"{tmp_path}result.nc":WARNING_STATUS {tmp_path}result_WARNING_STATUS_{file_date}_lcc.tif', shell=True)
subprocess.run(f'gdal_translate -ot Float32 -of GTiff -b {timestep_index} NETCDF:"{tmp_path}result.nc":TM {tmp_path}result_{file_date}_lcc.tif', shell=True)
# Need to reproject the files, to ensure we have the projection given in the generted mapfile. We always use EPSG:4326 for this
subprocess.run(f'gdalwarp -t_srs EPSG:4326 {tmp_path}result_WARNING_STATUS_{file_date}_lcc.tif {out_path}result_WARNING_STATUS_{file_date}.tif', shell=True)
subprocess.run(f'gdalwarp -t_srs EPSG:4326 {tmp_path}result_{file_date}_lcc.tif {out_path}result_{file_date}.tif', shell=True)
"""
timestep_index = timestep_index + 1
if len(timestep_dates) != len(set(timestep_dates)):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment