Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Solar Orbiter PHI instrument #352

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions install/database/2024_02_09_solo_phi.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
INSERT INTO datasources (id, name, description, units, layeringOrder, enabled, sourceIdGroup, displayOrder)
VALUES
(95, 'SOLO PHI FDT BLOS', 'SOLO PHI FDT BLOS', NULL, 1, 0, '', 0),
(96, 'SOLO PHI FDT ICNT', 'SOLO PHI FDT ICNT', NULL, 1, 0, '', 0),
(97, 'SOLO PHI HRT BLOS', 'SOLO PHI HRT BLOS', NULL, 1, 0, '', 0),
(98, 'SOLO PHI HRT ICNT', 'SOLO PHI HRT ICNT', NULL, 1, 0, '', 0);

INSERT INTO datasource_property (sourceId, label, name, fitsName, description, uiOrder)
VALUES
(95, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(96, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(97, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(98, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(95, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(96, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(97, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(98, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(95, 'Detector', 'FDT', 'FDT', 'Full Disk Telescope', 3),
(96, 'Detector', 'FDT', 'FDT', 'Full Disk Telescope', 3),
(97, 'Detector', 'HRT', 'HRT', 'High Resolution Telescope', 3),
(98, 'Detector', 'HRT', 'HRT', 'High Resolution Telescope', 3),
(95, 'Measurement', 'BLOS', 'BLOS', 'Line of Sight Magnetic Field', 4),
(96, 'Measurement', 'ICNT', 'ICNT', 'Intensity', 4),
(97, 'Measurement', 'BLOS', 'BLOS', 'Line of Sight Magnetic Field', 4),
(98, 'Measurement', 'ICNT', 'ICNT', 'Intensity', 4);
20 changes: 20 additions & 0 deletions install/helioviewer/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,10 @@ def create_datasource_table(cursor):
(92, 'IRIS SJI 2832', 'IRIS SJI 2832', NULL, 1, 0, '', 0, 0, 0, 0),
(93, 'IRIS SJI 5000', 'IRIS SJI 5000', NULL, 1, 0, '', 0, 0, 0, 0),
(94, 'GONG H-alpha', 'GONG H-Alpha', NULL, 1, 0, '', 0, 0, 0, 0),
(95, 'SOLO PHI FDT BLOS', 'SOLO PHI FDT BLOS', NULL, 1, 0, '', 0, 0, 0, 0),
(96, 'SOLO PHI FDT ICNT', 'SOLO PHI FDT ICNT', NULL, 1, 0, '', 0, 0, 0, 0),
(97, 'SOLO PHI HRT BLOS', 'SOLO PHI HRT BLOS', NULL, 1, 0, '', 0, 0, 0, 0),
(98, 'SOLO PHI HRT ICNT', 'SOLO PHI HRT ICNT', NULL, 1, 0, '', 0, 0, 0, 0),
(2000, 'GOES-R SUVI 94', 'GOES-R SUVI 94', NULL, 1, 0, '', 0, 0, 0, 0),
(2001, 'GOES-R SUVI 131', 'GOES-R SUVI 131', NULL, 1, 0, '', 0, 0, 0, 0),
(2002, 'GOES-R SUVI 171', 'GOES-R SUVI 171', NULL, 1, 0, '', 0, 0, 0, 0),
Expand Down Expand Up @@ -419,6 +423,10 @@ def create_datasource_property_table(cursor):
(92, 'Observatory', 'IRIS', 'IRIS', 'IRIS', 1),
(93, 'Observatory', 'IRIS', 'IRIS', 'IRIS', 1),
(94, 'Observatory', 'GONG', 'NSO-GONG', 'GONG', 1),
(95, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(96, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(97, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(98, 'Observatory', 'SOLO', 'Solar_Orbiter', 'Solar Orbiter', 1),
(2000, 'Observatory', 'GOES-R', 'GOES-R', 'GOES-R', 1),
(2001, 'Observatory', 'GOES-R', 'GOES-R', 'GOES-R', 1),
(2002, 'Observatory', 'GOES-R', 'GOES-R', 'GOES-R', 1),
Expand Down Expand Up @@ -472,6 +480,10 @@ def create_datasource_property_table(cursor):
(92, 'Instrument', 'SJI', 'SJI', 'Slit Jaw Imager', 2),
(93, 'Instrument', 'SJI', 'SJI', 'Slit Jaw Imager', 2),
(94, 'Instrument', 'GONG', 'GONG', 'GONG', 2),
(95, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(96, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(97, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(98, 'Instrument', 'PHI', 'PHI', 'Polarimetric and Helioseismic Imager', 2),
(2000, 'Instrument', 'SUVI', 'SUVI', 'Solar UltraViolet Imager', 2),
(2001, 'Instrument', 'SUVI', 'SUVI', 'Solar UltraViolet Imager', 2),
(2002, 'Instrument', 'SUVI', 'SUVI', 'Solar UltraViolet Imager', 2),
Expand All @@ -497,6 +509,10 @@ def create_datasource_property_table(cursor):
(86, 'Detector', 'HRI', 'HRI_EUV', 'High Resolution Imager Extreme Ultraviolet', 3),
(87, 'Detector', 'HRI', 'HRI_LYA', 'High Resolution Imager Lyman-a', 3),
(94, 'Detector', 'H-alpha', 'H-alpha', 'H-alpha', 3),
(95, 'Detector', 'FDT', 'FDT', 'Full Disk Telescope', 3),
(96, 'Detector', 'FDT', 'FDT', 'Full Disk Telescope', 3),
(97, 'Detector', 'HRT', 'HRT', 'High Resolution Telescope', 3),
(98, 'Detector', 'HRT', 'HRT', 'High Resolution Telescope', 3),
(0, 'Measurement', '171', '171', '171 Ångström extreme ultraviolet', 3),
(1, 'Measurement', '195', '195', '195 Ångström extreme ultraviolet', 3),
(2, 'Measurement', '284', '284', '284 Ångström extreme ultraviolet', 3),
Expand Down Expand Up @@ -541,6 +557,10 @@ def create_datasource_property_table(cursor):
(92, 'Measurement', '2832', '2832', '2832 Ångström', 3),
(93, 'Measurement', '5000', '5000', '5000 Ångström', 3),
(94, 'Measurement', '6562', '6562', 'H-alpha 6562 angstrom', 4),
(95, 'Measurement', 'BLOS', 'BLOS', 'Line of Sight Magnetic Field', 4),
(96, 'Measurement', 'ICNT', 'ICNT', 'Intensity', 4),
(97, 'Measurement', 'BLOS', 'BLOS', 'Line of Sight Magnetic Field', 4),
(98, 'Measurement', 'ICNT', 'ICNT', 'Intensity', 4),
(2000, 'Measurement', '94', '94', '94 Ångström', 3),
(2001, 'Measurement', '131', '131', '131 Ångström', 3),
(2002, 'Measurement', '171', '171', '171 Ångström', 3),
Expand Down
3 changes: 1 addition & 2 deletions install/helioviewer/hvpull/downloader/localmove.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
"""moves files from one location on the local file system to another"""
import os
import logging
import threading
import time
import shutil
from downloader_interface import Downloader
from .downloader_interface import Downloader

class LocalFileMove(Downloader):
def __init__(self, incoming, queue):
Expand Down
3 changes: 2 additions & 1 deletion install/helioviewer/hvpull/net/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,8 @@ def get_servers(cls):
"suvi": "SUVIDataServer",
"iris": "IRISDataServer",
"hv_iris": "HvIRISDataServer",
"halpha": "GongDataServer"
"halpha": "GongDataServer",
"phi": "PHIDataServer"
}

@classmethod
Expand Down
19 changes: 19 additions & 0 deletions install/helioviewer/hvpull/servers/phi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import os
from datetime import datetime

from helioviewer.hvpull.servers import DataServer

class PHIDataServer(DataServer):
def __init__(self):
"""This assumes that SOLO jp2 files are stored locally.
Note that a full path is required to specify the location of the data."""
DataServer.__init__(self, "/tmp/phi", "PHI")

def compute_directories(self, start_date, end_date):
"""Computes a list of remote directories expected to contain files"""
return [self.uri]

def get_datetime_from_file(self, filename):

t = os.path.basename(filename)[21:36]
return datetime.strptime(t, "%Y%m%dT%H%M%S")
20 changes: 20 additions & 0 deletions install/helioviewer/jp2parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ def getData(self):
elif image['observatory'] == "Hinode":
image['filter1'] = measurement.split("-")[0].replace(" ", "_")
image['filter2'] = measurement.split("-")[1].replace(" ", "_")
elif image['observatory'] == 'Solar_Orbiter':
self._IdentifySolarOrbiterData(image, measurement, imageData)
else:
image['measurement'] = measurement
image['date'] = imageData.date
Expand All @@ -109,6 +111,24 @@ def getData(self):

return image

def _IdentifySolarOrbiterData(self, image, measurement, imageData):
assert image['observatory'] == 'Solar_Orbiter'
try:
if image['detector'] == 'FDT':
btype = imageData.meta['btype'].lower()
if "magnetic field" in btype:
measurement = "BLOS"
elif "intensity" in btype:
measurement = "ICNT"
elif image['detector'] == 'HRT':
measurement = imageData.meta['btype'].upper()
except Exception as e:
# If for whatever reason we can't read the btype from the image data
# then just continue with the default behavior. Which probably
# still won't work...
pass
image['measurement'] = measurement

def read_header_only_but_still_use_sunpy_map(self, patch_cunit=False):
"""
Reads the header for a JPEG200 file and returns some dummy data.
Expand Down
47 changes: 47 additions & 0 deletions src/Image/ImageType/PHIImage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php
/**
* Image_ImageType_PHIImage class definition
* There is one xxxImage for each type of detector Helioviewer supports.
*
* @category Image
* @package Helioviewer
* @author Daniel Garcia Briseno <[email protected]>
* @license http://www.mozilla.org/MPL/MPL-1.1.html Mozilla Public License 1.1
* @link https://github.com/Helioviewer-Project
*/
require_once HV_ROOT_DIR.'/../src/Image/HelioviewerImage.php';

class Image_ImageType_PHIImage extends Image_HelioviewerImage {
/**
* Creates a new PHIImage
*
* @param string $jp2 Source JP2 image
* @param string $filepath Location to output the file to
* @param array $roi Top-left and bottom-right pixel coordinates on the image
* @param array $uiLabels Datasource label hierarchy
* @param int $offsetX Offset of the sun center from the image center
* @param int $offsetY Offset of the sun center from the iamge center
* @param array $options Optional parameters
*
* @return void
*/
public function __construct($jp2, $filepath, $roi, $uiLabels, $offsetX, $offsetY, $options) {
// Use grayscale for now
$this->setColorTable(false);

parent::__construct($jp2, $filepath, $roi, $uiLabels, $offsetX, $offsetY, $options);
}

/**
* Gets a string that will be displayed in the image's watermark
*
* @return string watermark name
*/
public function getWaterMarkName() {
$type = $this->uiLabels[2]['name'];
$measurement = $this->uiLabels[3]['name'];
$watermark = 'PHI '.$type.' '.$measurement."\n";
return $watermark;
}
}
?>
Loading