Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Grid NAERSTADMO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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 NAERSTADMO
Commits
9591fc27
Commit
9591fc27
authored
1 year ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Plain Diff
Merge branch 'revert-
b9aede7d
' into 'main'
Revert "Bugfix: Remove outtmp_path, replace with outfile_path (from .env)" See merge request
!1
parents
b9aede7d
cdd725d5
No related branches found
No related tags found
1 merge request
!1
Revert "Bugfix: Remove outtmp_path, replace with outfile_path (from .env)"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NAERSTADMO.py
+6
-5
6 additions, 5 deletions
NAERSTADMO.py
with
6 additions
and
5 deletions
NAERSTADMO.py
+
6
−
5
View file @
9591fc27
...
...
@@ -22,6 +22,7 @@ config.read("NAERSTADMO.cfg")
infile_path
=
os
.
getenv
(
"
WEATHER_DATA_DIR
"
)
outfile_path
=
os
.
getenv
(
"
DATA_DIR
"
)
outtmp_path
=
"
out/
"
tmpfile_path
=
"
tmp/
"
bg_filename
=
(
f
'
{
tmpfile_path
}
background_data.nc
'
)
...
...
@@ -37,7 +38,7 @@ def create_dataset():
# Find the latest file from previous run to create a start date
last_final_date
=
None
list_of_files
=
glob
.
glob
(
f
"
{
out
file
_path
}
final_2[0-9][0-9][0-9]-[01][0-9]-[0123][0-9].nc
"
,
recursive
=
True
)
list_of_files
=
glob
.
glob
(
f
"
{
out
tmp
_path
}
final_2[0-9][0-9][0-9]-[01][0-9]-[0123][0-9].nc
"
,
recursive
=
True
)
print
(
list_of_files
)
if
list_of_files
:
latest_file
=
max
(
list_of_files
,
key
=
os
.
path
.
getctime
)
...
...
@@ -71,7 +72,7 @@ def create_dataset():
subprocess
.
run
(
f
'
cdo -f nc2 mergetime
{
file
}
{
tmpfile_path
}
tmpfile.nc
{
tmpfile_path
}
weather_data.nc
'
,
shell
=
True
)
subprocess
.
run
(
f
'
rm
{
tmpfile_path
}
tmpfile.nc
'
,
shell
=
True
)
subprocess
.
run
(
f
'
rm
{
out
file
_path
}
final_*
'
,
shell
=
True
)
subprocess
.
run
(
f
'
rm
{
out
tmp
_path
}
final_*
'
,
shell
=
True
)
create_saturation
()
create_pressure
()
...
...
@@ -195,10 +196,10 @@ def create_matrix():
subprocess
.
run
(
f
'
cdo -expr,
"
TSWH=(WHS==0)?0:sumWHTM;IR=(TSWH>=40?1:0);RISK=(IR==1?(TSWH/40)*VRS:0);VRS=(VRS==0?0:VRS);
"
{
tmpfile_path
}
bg_final_
{
str
(
time
)
}
.nc
{
tmpfile_path
}
final_
{
str
(
date
)
}
_
{
str
(
hour
)
}
.nc
'
,
shell
=
True
)
if
(
str
(
hour
)
==
'
00
'
or
time
==
1
):
subprocess
.
run
(
f
'
cp
{
tmpfile_path
}
final_
{
str
(
date
)
}
_
{
str
(
hour
)
}
.nc
{
out
file
_path
}
final_
{
str
(
date
)
}
.nc
'
,
shell
=
True
)
subprocess
.
run
(
f
'
cp
{
tmpfile_path
}
final_
{
str
(
date
)
}
_
{
str
(
hour
)
}
.nc
{
out
tmp
_path
}
final_
{
str
(
date
)
}
.nc
'
,
shell
=
True
)
else
:
subprocess
.
run
(
f
'
cp
{
out
file
_path
}
final_
{
str
(
date
)
}
.nc
{
tmpfile_path
}
tmp_
{
str
(
date
)
}
.nc
'
,
shell
=
True
)
subprocess
.
run
(
f
'
cdo -O -mergetime
{
tmpfile_path
}
tmp_
{
str
(
date
)
}
.nc
{
tmpfile_path
}
final_
{
str
(
date
)
}
_
{
str
(
hour
)
}
.nc
{
out
file
_path
}
final_
{
str
(
date
)
}
.nc
'
,
shell
=
True
)
subprocess
.
run
(
f
'
cp
{
out
tmp
_path
}
final_
{
str
(
date
)
}
.nc
{
tmpfile_path
}
tmp_
{
str
(
date
)
}
.nc
'
,
shell
=
True
)
subprocess
.
run
(
f
'
cdo -O -mergetime
{
tmpfile_path
}
tmp_
{
str
(
date
)
}
.nc
{
tmpfile_path
}
final_
{
str
(
date
)
}
_
{
str
(
hour
)
}
.nc
{
out
tmp
_path
}
final_
{
str
(
date
)
}
.nc
'
,
shell
=
True
)
subprocess
.
run
(
f
'
rm
{
tmpfile_path
}
tmp_
{
str
(
date
)
}
.nc
{
tmpfile_path
}
final_
{
str
(
date
)
}
_
{
str
(
hour
)
}
.nc
'
,
shell
=
True
)
# Create last hour values
...
...
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