Skip to content

Commit 9479366

Browse files
committed
change flarelist to L3
1 parent 02e24a5 commit 9479366

12 files changed

Lines changed: 543 additions & 68 deletions

File tree

processed.sqlite

24 KB
Binary file not shown.

stixcore/data/stixcore.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ parallel_batchsize_L0 = 300
1515
parallel_batchsize_L1 = 300
1616
parallel_batchsize_L2 = 100
1717
flareid_sdc_lut_file = ./stixcore/data/publish/flarelist_sdc_lut.csv
18+
flareid_sc_lut_file = ./stixcore/data/publish/flarelist_sc_lut.csv
1819
[Publish]
1920
db_file = ./stixcore/data/publish/published.sqlite
2021
include_levels = L0

stixcore/io/FlareListManager.py

Lines changed: 277 additions & 11 deletions
Large diffs are not rendered by default.

stixcore/io/fits/processors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,8 @@ def generate_filename(self, product, *, version=0, suffix='.svg'):
10841084
Path
10851085
a Path object with full name and path
10861086
"""
1087-
p = Path(super().generate_filename(product=product, version=version, header=True))
1087+
p = Path(super().generate_filename(product=product, version=version,
1088+
header=True, status='C'))
10881089
return p.with_suffix(suffix).name
10891090

10901091
def generate_primary_header(self, filename, product, *, version=0):

stixcore/processing/AspectANC.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ def __init__(self, source_dir: Path, output_dir: Path):
3939
self.source_dir = Path(source_dir)
4040
self.output_dir = Path(output_dir)
4141

42+
def get_processing_files(self, phs) -> list[Path]:
43+
"""Returns a list of all files which should be processed by this step.
44+
45+
Returns
46+
-------
47+
list[Path]
48+
a list of fits files candidates
49+
"""
50+
hk_in_files = []
51+
52+
for fc in self.find_processing_candidates():
53+
tr = self.test_for_processing(fc, phs)
54+
if tr == TestForProcessingResult.Suitable:
55+
hk_in_files.append(fc)
56+
return hk_in_files
57+
4258
def find_processing_candidates(self) -> list[Path]:
4359
"""Performs file pattern search in the source directory
4460

stixcore/processing/FLtoFL.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
SingleProductProcessingStepMixin,
1414
TestForProcessingResult,
1515
)
16-
from stixcore.products.ANC.flarelist import (
17-
FlareListProduct,
16+
from stixcore.products.level3.flarelist import (
17+
FlareList,
1818
FlarePeekPreviewMixin,
1919
FlarePositionMixin,
2020
FlareSOOPMixin,
@@ -30,7 +30,7 @@
3030

3131

3232
class FLtoFL(SingleProductProcessingStepMixin):
33-
"""Processing step from a HK L1 fits file to a solo_ANC_stix-asp-ephemeris*.fits file.
33+
"""Processing step from enhance monthly flare list files to next processing steep
3434
"""
3535
INPUT_PATTERN = "solo_ANC_stix-flarelist-sdc*.fits"
3636

@@ -84,8 +84,8 @@ def get_processing_files(self, phs: ProcessingHistoryStorage) -> list[Path]:
8484
return fl_to_process
8585

8686
def test_for_processing(self, candidate: Path,
87-
product_in: FlareListProduct,
88-
product_out: FlareListProduct,
87+
product_in: FlareList,
88+
product_out: FlareList,
8989
phm: ProcessingHistoryStorage) -> TestForProcessingResult:
9090
"""_summary_
9191
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@
1212
SingleProductProcessingStepMixin,
1313
TestForProcessingResult,
1414
)
15-
from stixcore.products.ANC.flarelist import FlarePositionMixin, FlareSOOPMixin
15+
from stixcore.products.level3.flarelist import FlarePositionMixin, FlareSOOPMixin
1616
from stixcore.soop.manager import SOOPManager
1717
from stixcore.util.logging import get_logger
1818

19-
__all__ = ['FlareListANC', 'FlarePositionMixin']
19+
__all__ = ['FlareListL3']
2020

2121
logger = get_logger(__name__)
2222

2323

24-
class FlareListANC(SingleProductProcessingStepMixin):
25-
"""Processing step from a FlareListManager to monthly solo_ANC_stix-flarelist-*.fits file.
24+
class FlareListL3(SingleProductProcessingStepMixin):
25+
"""Processing step from a FlareListManager to monthly solo_L3_stix-flarelist-*.fits file.
2626
"""
2727

2828
STARTDATE = date(2024, 1, 1)
@@ -49,7 +49,7 @@ def find_processing_months(self, phs: ProcessingHistoryStorage) -> list[date]:
4949
a list of fits files candidates
5050
"""
5151
fl_months = list()
52-
for month in pd.date_range(FlareListANC.STARTDATE, date.today(), freq='MS').date:
52+
for month in pd.date_range(FlareListL3.STARTDATE, date.today(), freq='MS').date:
5353
if self.test_for_processing(month, phs) == TestForProcessingResult.Suitable:
5454
fl_months.append(month)
5555
return fl_months
@@ -75,7 +75,7 @@ def test_for_processing(self, month: date,
7575
self.flm.productCls.LEVEL,
7676
self.flm.productCls.TYPE,
7777
self.flm.productCls.get_cls_processing_version(),
78-
str(month), FlareListANC.STARTDATE)
78+
str(month), FlareListL3.STARTDATE)
7979

8080
# found already in the processing history
8181
if wp:
@@ -93,7 +93,7 @@ def test_for_processing(self, month: date,
9393
def process_fits_files(self, months: list[date], *, soopmanager: SOOPManager,
9494
spice_kernel_path: Path, processor, config) -> list[Path]:
9595
"""Performs the processing (expected to run in a dedicated python process) from a
96-
list of solo_L1_stix-hk-maxi_*.fits into solo_ANC_stix-asp-ephemeris*.fits files.
96+
list of time periods (months) and creates a FITS file for each one.
9797
9898
Parameters
9999
----------

stixcore/processing/pipeline_daily.py

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from datetime import date, timedelta
88
from concurrent.futures import ProcessPoolExecutor
99

10+
from stixpy.net.client import STIXClient
11+
1012
from stixcore.config.config import CONFIG
1113
from stixcore.ephemeris.manager import Spice, SpiceKernelManager
1214
from stixcore.io.fits.processors import (
@@ -15,17 +17,24 @@
1517
FitsL3Processor,
1618
PlotProcessor,
1719
)
18-
from stixcore.io.FlareListManager import SDCFlareListManager
20+
from stixcore.io.FlareListManager import SCFlareListManager, SDCFlareListManager
1921
from stixcore.io.ProcessingHistoryStorage import ProcessingHistoryStorage
2022
from stixcore.io.RidLutManager import RidLutManager
2123
from stixcore.processing.AspectANC import AspectANC
22-
from stixcore.processing.FlareListANC import FlareListANC
24+
from stixcore.processing.FlareListL3 import FlareListL3
2325
from stixcore.processing.FLtoFL import FLtoFL
2426
from stixcore.processing.LL import LL03QL
2527
from stixcore.processing.pipeline import PipelineStatus
26-
from stixcore.processing.SingleStep import SingleProcessingStepResult, TestForProcessingResult
27-
from stixcore.products.ANC.flarelist import FlarelistSDCLoc, FlarelistSDCLocImg
28+
from stixcore.processing.SingleStep import SingleProcessingStepResult
2829
from stixcore.products.level1.quicklookL1 import LightCurve
30+
from stixcore.products.level3.flarelist import (
31+
FlarelistSC,
32+
FlarelistSCLoc,
33+
FlarelistSCLocImg,
34+
FlarelistSDC,
35+
FlarelistSDCLoc,
36+
FlarelistSDCLocImg,
37+
)
2938
from stixcore.products.lowlatency.quicklookLL import LightCurveL3
3039
from stixcore.soop.manager import SOOPManager
3140
from stixcore.util.logging import STX_LOGGER_DATE_FORMAT, STX_LOGGER_FORMAT, get_logger
@@ -184,6 +193,13 @@ def run_daily_pipeline(args):
184193

185194
Path(CONFIG.get('Paths', 'fits_archive'))
186195

196+
fido_url = CONFIG.get('Paths', 'fido_search_url',
197+
fallback='https://pub099.cs.technik.fhnw.ch/data/fits')
198+
fido_client = STIXClient(source=fido_url)
199+
200+
flare_lut_file = Path(CONFIG.get('Pipeline', 'flareid_sc_lut_file'))
201+
SCFlareListManager.instance = SCFlareListManager(flare_lut_file, fido_client, update=True)
202+
187203
flare_lut_file = Path(CONFIG.get('Pipeline', 'flareid_sdc_lut_file'))
188204
SDCFlareListManager.instance = SDCFlareListManager(flare_lut_file, update=False)
189205

@@ -218,11 +234,14 @@ def run_daily_pipeline(args):
218234

219235
aspect_anc_processor = AspectANC(fits_in_dir, fits_out_dir)
220236

221-
flarelist_sdc = FlareListANC(SDCFlareListManager.instance, fits_out_dir)
237+
flarelist_sdc = FlareListL3(SDCFlareListManager.instance, fits_out_dir)
238+
flarelist_sc = FlareListL3(SCFlareListManager.instance, fits_out_dir)
222239
fl_to_fl = FLtoFL(fits_in_dir,
223240
fits_out_dir,
224-
products_in_out=[ # (FlarelistSDC, FlarelistSDCLoc),
225-
(FlarelistSDCLoc, FlarelistSDCLocImg)],
241+
products_in_out=[(FlarelistSDC, FlarelistSDCLoc),
242+
(FlarelistSDCLoc, FlarelistSDCLocImg),
243+
(FlarelistSC, FlarelistSCLoc),
244+
(FlarelistSCLoc, FlarelistSCLocImg)],
226245
cadence=timedelta(seconds=1))
227246

228247
ll03ql = LL03QL(fits_in_dir, fits_out_dir, in_product=LightCurve, out_product=LightCurveL3,
@@ -233,23 +252,20 @@ def run_daily_pipeline(args):
233252
l3_fits_writer = FitsL3Processor(fits_out_dir)
234253
anc_fits_writer = FitsANCProcessor(fits_out_dir)
235254

236-
# should be done later: internally
255+
# hk_in_files = aspect_anc_processor.get_processing_files(phs)
237256
hk_in_files = []
238-
candidates = list() # aspect_anc_processor.find_processing_candidates()
239-
v_candidates = aspect_anc_processor.get_version(candidates, version="latest")
240-
for fc in v_candidates:
241-
tr = aspect_anc_processor.test_for_processing(fc, phs)
242-
if tr == TestForProcessingResult.Suitable:
243-
hk_in_files.append(fc)
244257

245-
fl_months = flarelist_sdc.find_processing_months(phs)
246-
fl_months = []
258+
fl_sdc_months = flarelist_sdc.find_processing_months(phs)
259+
# fl_sdc_months = []
260+
261+
# fl_sc_months = flarelist_sc.find_processing_months(phs)
262+
fl_sc_months = []
247263

248-
ll_candidates = ll03ql.get_processing_files(phs)
264+
# ll_candidates = ll03ql.get_processing_files(phs)
249265
ll_candidates = []
250266

251267
fl_to_fl_files = fl_to_fl.get_processing_files(phs)
252-
# flsdc_to_flcdspos_files = []
268+
# fl_to_fl_files = []
253269

254270
# all processing files should be terminated before the next step as the different
255271
# processing steeps might create new candidates
@@ -262,10 +278,16 @@ def run_daily_pipeline(args):
262278
processor=l2_fits_writer,
263279
config=CONFIG))
264280

265-
jobs.append(executor.submit(flarelist_sdc.process_fits_files, fl_months,
281+
jobs.append(executor.submit(flarelist_sdc.process_fits_files, fl_sdc_months,
282+
soopmanager=SOOPManager.instance,
283+
spice_kernel_path=Spice.instance.meta_kernel_path,
284+
processor=l3_fits_writer,
285+
config=CONFIG))
286+
287+
jobs.append(executor.submit(flarelist_sc.process_fits_files, fl_sc_months,
266288
soopmanager=SOOPManager.instance,
267289
spice_kernel_path=Spice.instance.meta_kernel_path,
268-
processor=anc_fits_writer,
290+
processor=l3_fits_writer,
269291
config=CONFIG))
270292

271293
# TODO a owen processing step for each flarelist file?

stixcore/processing/publish.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,8 @@ def publish_fits_to_esa(args):
541541

542542
parser.add_argument("-l", "--include_levels",
543543
help="what levels should be published", type=str,
544-
default=CONFIG.get('Publish', 'include_levels', fallback="L0, L1, L2, ANC"))
544+
default=CONFIG.get('Publish', 'include_levels',
545+
fallback="L0, L1, L2, ANC, LL03"))
545546

546547
parser.add_argument("-p", "--include_products",
547548
help="what products should be published", type=str,

0 commit comments

Comments
 (0)