Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
sdc
kis_tools
Commits
57e9b2c1
Commit
57e9b2c1
authored
Mar 09, 2021
by
Carl Schaffer
Browse files
adding date-run instantiation to GrisRun
parent
70657ec6
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
kis_tools/gris/GrisFitsFile.py
View file @
57e9b2c1
...
...
@@ -18,6 +18,7 @@ import matplotlib.pyplot as plt
import
numpy
as
np
from
astropy.coordinates
import
SkyCoord
,
Angle
from
astropy.wcs
import
WCS
from
pandas
import
to_datetime
from
kis_tools.generic.fits
import
FitsFile
from
kis_tools.gris.coord_correction_ml
import
get_coords_ml
...
...
@@ -62,6 +63,25 @@ class GrisFitsFile(FitsFile):
self
.
parse_filename
()
self
.
is_parsed
=
False
@
classmethod
def
from_date_run
(
cls
,
date
,
run_number
):
# Check date for validity, try to cast to date
if
not
isinstance
(
date
,
datetime
):
date
=
to_datetime
(
date
)
# Check operating system and set path accordingly
# Assumes mars mounted at Y: on windows
if
sys
.
platform
==
"win32"
:
archive_root
=
Path
(
'Y:\dat'
)
else
:
archive_root
=
Path
(
'/dat'
)
archive
=
archive_root
/
'sdc'
/
'gris'
/
date
.
strftime
(
"%Y%m%d"
)
/
'level1_split'
# Glob for files matching the run
pattern
=
f
'*l1?_
{
run_number
:
03
d
}
*'
return
GrisFitsFile
(
list
(
*
archive
.
glob
(
pattern
)))
def
parse_filename
(
self
):
"""Extract metadata from filename"""
# Extract time from Filename
...
...
Carl Schaffer
@schaffer
mentioned in commit
a6ccd0f9
·
Mar 09, 2021
mentioned in commit
a6ccd0f9
mentioned in commit a6ccd0f9440908e8fcdad359e93b8e80c37d0237
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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