Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mHM Tools
Manage
Activity
Members
Labels
Plan
Issues
7
Issue boards
Milestones
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mhm
mHM Tools
Commits
f7932f94
Commit
f7932f94
authored
5 months ago
by
Valentin Simon Lüdke
Browse files
Options
Downloads
Patches
Plain Diff
Change output_filenames and remove temporary files
parent
6d5da66a
No related branches found
No related tags found
4 merge requests
!16
Generate classical mhm setups from classical setup
,
!15
Draft: Cut classical mhm setups
,
!12
Add region and catchment masking
,
!8
Draft: Resolve "Pre-Proc: incorporate tools for creating global setups"
Pipeline
#234529
failed with stages
in 1 minute and 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mhm_tools/pre/catchment.py
+14
-8
14 additions, 8 deletions
src/mhm_tools/pre/catchment.py
with
14 additions
and
8 deletions
src/mhm_tools/pre/catchment.py
+
14
−
8
View file @
f7932f94
...
...
@@ -409,6 +409,7 @@ def create_catchment(
latlon
=
True
if
gauge_coords
is
None
:
temp_file1
=
"
hydro1.nc
"
global_catchments
=
Catchment
(
ds
=
ds
,
var_name
=
var_name
,
...
...
@@ -416,10 +417,11 @@ def create_catchment(
ftype
=
ftype
,
transform
=
transform
,
latlon
=
latlon
,
out_var_name
=
"
hydro1.nc
"
,
out_var_name
=
temp_file1
,
do_shift
=
False
,
)
# create a shifted version of the catchment to avoid border effects
temp_file2
=
"
hydro2.nc
"
global_catchments_shifted
=
Catchment
(
ds
=
ds
,
var_name
=
var_name
,
...
...
@@ -427,7 +429,7 @@ def create_catchment(
ftype
=
ftype
,
transform
=
transform
,
latlon
=
latlon
,
out_var_name
=
"
hydro2.nc
"
,
out_var_name
=
temp_file2
,
do_shift
=
True
,
)
catchments
=
[
global_catchments
,
global_catchments_shifted
]
...
...
@@ -438,13 +440,18 @@ def create_catchment(
c
.
get_grid_area
()
# c.get_upstream_area()
c
.
write
(
output_path
,
single_file
=
True
)
# add paths to the temp files
temp_file1
=
pl
.
Path
(
output_path
,
"
hydro1.nc
"
)
temp_file2
=
pl
.
Path
(
output_path
,
"
hydro2.nc
"
)
logger
.
info
(
"
Merging catchment files
"
)
merge_catchment
(
pl
.
Path
(
output_path
,
"
hydro1.nc
"
)
,
pl
.
Path
(
output_path
,
"
hydro2.nc
"
)
,
pl
.
Path
(
output_path
,
"
hydro_merged
.nc
"
),
temp_file1
,
temp_file2
,
pl
.
Path
(
output_path
,
"
basin_ids
.nc
"
),
)
# remove the temporary files
temp_file1
.
unlink
()
temp_file2
.
unlink
()
else
:
logger
.
info
(
f
"
Creating catchment for gauge coordinates
{
gauge_coords
}
"
)
c
=
Catchment
(
...
...
@@ -454,11 +461,10 @@ def create_catchment(
ftype
=
ftype
,
transform
=
transform
,
latlon
=
latlon
,
out_var_name
=
"
hydro
.nc
"
,
out_var_name
=
"
basin_ids
.nc
"
,
do_shift
=
False
,
)
c
.
delineate_basin
(
gauge_coords
)
c
.
get_facc
()
c
.
get_grid_area
()
# c.get_upstream_area()
c
.
write
(
output_path
,
single_file
=
True
,
cut_by_basin
=
True
)
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