Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Floris Hermanns
RS_SiVM
Commits
b9dcedcb
Commit
b9dcedcb
authored
Jan 11, 2022
by
Floris Hermanns
Browse files
factorator output directory fix
parent
5927834a
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
b9dcedcb
...
...
@@ -25,18 +25,16 @@ Python scripts require the following modules:
*
pymf 0.3 (not available on conda/pypi, use included version, source: https://github.com/cthurau/pymf)
*
fmch (not available on conda/pypi, use included version)
*
numpy 1.18.5
*
scipy 1.4.1
*
math
*
colorsys
*
datetime
*
pickle
*
pandas 0.25.2
*
geopandas 0.6.1
*
matplotlib 3.1.1
*
spectral 0.20
*
pathlib 2.3.5
*
json 2.0.9
*
cvxopt
*
numpy
*
scipy
*
skimage
*
pandas
*
geopandas
*
matplotlib
*
spectral
*
h5py
*
pathlib
recommended:
*
HSI2RGB (https://github.com/JakobSig/HSI2RGB)
...
...
fmch/factorator.py
View file @
b9dcedcb
...
...
@@ -73,7 +73,7 @@ import warnings
# TODO: include support for any vector ROI mask
class
Factorator
():
def
__init__
(
self
,
wdir
,
meta
,
do_mkdir
=
False
):
#
def
__init__
(
self
,
wdir
,
meta
,
do_mkdir
=
False
,
fname
=
False
):
#
'''
Args:
wdir (str): The directory where BSQ files and the geopackage with
...
...
@@ -85,14 +85,22 @@ class Factorator():
when processing multiple sites.
'time': should contain a string identifier for different time
steps (can be year, date, etc.).
do_mkdir (bool): If true, the output directory is created. Only
necessary if results should be saved to disk.
do_mkdir (bool, optional): If true, the output directory is created.
fname (string, optional): Set a custom name for the working folder,
e.g. to continue previously produced results. If unused, a
generic output directory name will be used.
'''
self
.
_wdir
=
Path
(
wdir
)
# index is reset to prevent errors
self
.
meta
=
meta
.
sort_values
([
'site'
,
'time'
],
ascending
=
[
True
,
True
]).
reset_index
(
drop
=
True
)
ssm
=
round
((
datetime
.
now
()
-
datetime
.
now
().
replace
(
hour
=
0
,
minute
=
0
,
second
=
0
,
microsecond
=
0
)).
total_seconds
())
self
.
_odir
=
self
.
_wdir
.
parent
/
(
'sivm_out_'
+
date
.
today
().
isoformat
()
+
str
(
ssm
))
if
fname
==
False
:
fnamestr
=
'sivm_out_'
+
date
.
today
().
isoformat
()
+
str
(
ssm
)
elif
isinstance
(
fname
,
str
):
fnamestr
=
fname
else
:
raise
ValueError
(
'Fname must be a string.'
)
self
.
_odir
=
self
.
_wdir
.
parent
/
fnamestr
if
do_mkdir
==
True
:
try
:
(
self
.
_odir
/
'plots'
).
mkdir
(
parents
=
True
,
exist_ok
=
False
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment