Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WindEnergyToolbox
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Admin message
The Gitlab server is succesfully updated to version 17.10.3
Show more breadcrumbs
cmos
WindEnergyToolbox
Commits
9e705b8a
Commit
9e705b8a
authored
6 years ago
by
cmos
Browse files
Options
Downloads
Patches
Plain Diff
" Added company file capabilities "
parent
ac2bc330
No related branches found
No related tags found
No related merge requests found
Pipeline
#6115
failed
6 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
wetb/hawc2/hawc2_simulation.py
+32
-0
32 additions, 0 deletions
wetb/hawc2/hawc2_simulation.py
with
32 additions
and
0 deletions
wetb/hawc2/hawc2_simulation.py
+
32
−
0
View file @
9e705b8a
...
...
@@ -49,6 +49,10 @@ class Hawc2_Simulation(object):
# The directories for the source and the destination
self
.
source_directory
=
None
self
.
write_directory
=
None
#CMOS: company file.
self
.
company_files
=
None
# indicates that the sensors in the source htc file are normalized
self
.
source_sensors_normalized
=
False
# indicates that the object should keep the sensors normalized
...
...
@@ -149,6 +153,22 @@ class Hawc2_Simulation(object):
if
self
.
write_directory
==
self
.
source_directory
and
not
force_write
:
raise
Exception
(
'
Cannot write the contents into the source directory without the write being forced
'
)
#CMOS: Copying company files:
if
not
self
.
company_files
is
None
:
company_index
=
0
for
company_file
in
self
.
company_files
:
if
self
.
company_destinations
[
company_index
]
is
None
:
shutil
.
copy
(
company_file
,
self
.
write_directory
)
else
:
try
:
shutil
.
copy
(
company_file
,
self
.
write_directory
+
self
.
company_destinations
[
company_index
])
except
:
print
(
'
CMOS: Something went wrong when copying company files. The file is put in the writing directory
'
)
shutil
.
copy
(
company_file
,
self
.
write_directory
)
company_index
+=
1
#CMOS - end
# Get the directory
old_home
=
os
.
getcwd
()
...
...
@@ -205,6 +225,18 @@ class Hawc2_Simulation(object):
# This will set the write directory
def
set_write_directory
(
self
,
write_directory
):
self
.
write_directory
=
os
.
path
.
abspath
(
os
.
path
.
realpath
(
write_directory
))
#CMOS: Set company file:
def
set_company_file
(
self
,
company_file
,
destination
=
None
):
if
self
.
company_files
is
None
:
self
.
company_files
=
list
()
self
.
company_files
.
append
(
os
.
path
.
abspath
(
os
.
path
.
realpath
(
company_file
)))
self
.
company_destinations
=
list
()
self
.
company_destinations
.
append
(
destination
)
else
:
self
.
company_files
.
append
(
os
.
path
.
abspath
(
os
.
path
.
realpath
(
company_file
)))
self
.
company_destiantions
.
append
(
destination
)
#CMOS - end
# Tests whether the input for the current state has already been written
def
does_input_exist
(
self
):
...
...
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