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
6925935c
Commit
6925935c
authored
3 months ago
by
Lene Wasskog
Browse files
Options
Downloads
Patches
Plain Diff
feat: Check if files exist before attempting to remove
parent
8ac28ec9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SEPTREFHUM.py
+4
-1
4 additions, 1 deletion
SEPTREFHUM.py
with
4 additions
and
1 deletion
SEPTREFHUM.py
+
4
−
1
View file @
6925935c
...
...
@@ -253,7 +253,10 @@ for timestep in timesteps:
# Merge the WARNING_STATUS and WHS variables into one GeoTIFF file with two bands.
# The WARNING_STATUS should always be band #1
# We must delete the GeoTIFF file before merging
run_command
(
command
=
f
'
rm
{
result_tif_path
}
result_*
{
file_date
}
*.tif
'
)
existing_result_files_for_date
=
f
"
{
result_tif_path
}
result_*
{
file_date
}
*.tif
"
files
=
glob
.
glob
(
existing_result_files_for_date
)
if
files
:
run_command
(
command
=
f
'
rm
{
existing_result_files_for_date
}
'
)
with
open
(
"
/dev/null
"
,
"
w
"
)
as
devnull
:
run_command
(
command
=
f
'
gdal_translate -ot Int16 -of GTiff NETCDF:
"
{
tmpfile_path
}
result_
{
file_date
}
.nc
"
:WARNING_STATUS
{
tmpfile_path
}
result_WARNING_STATUS_
{
file_date
}
_lcc.tif
'
,
stdout
=
devnull
)
run_command
(
command
=
f
'
gdal_translate -ot Float32 -of GTiff NETCDF:
"
{
tmpfile_path
}
result_
{
file_date
}
.nc
"
:WHS
{
tmpfile_path
}
result_
{
file_date
}
_lcc.tif
'
,
stdout
=
devnull
)
...
...
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