Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grid SEPTREFHUM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
Models
GRID
Grid SEPTREFHUM
Commits
672c041b
Commit
672c041b
authored
1 year ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Change final output from WH_DAYSUM to WHS
parent
16b561bb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SEPTREFHUM.py
+10
-7
10 additions, 7 deletions
SEPTREFHUM.py
with
10 additions
and
7 deletions
SEPTREFHUM.py
+
10
−
7
View file @
672c041b
...
...
@@ -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_
DAY
SUM[yesterday] + WH_
DAY
SUM[today] + WH_
DAY
SUM[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 = 4
7
hours
# The difference [1] - [0] should be 172800 seconds = 4
8
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment