Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
oceancolorcoder committed Nov 27, 2024
2 parents 7921730 + 7c982d0 commit a53b354
Show file tree
Hide file tree
Showing 38 changed files with 1,545 additions and 580 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ run_*.py

# copernicus url and keys
.cdsapirc
# gitignore only skips new files, not updates to existing files
.ecmwf_api_config

#ignore ".idea/" if working with pycharm:
Expand Down
6 changes: 2 additions & 4 deletions Config/sample_SEABIRD_pySAS.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"fL1aqcPitchRollPitch": 5.0,
"fL1aqcPitchRollRoll": 5.0,
"fL1aqcRotatorHomeAngle": 0.0,
"bL1aqcRotatorDelay": 1,
"bL1aqcRotatorDelay": 0,
"fL1aqcRotatorDelay": 2.0,
"bL1aqcRotatorAngle": 1,
"bL1aqcRotatorAngle": 0,
"fL1aqcRotatorAngleMin": -126.0,
"fL1aqcRotatorAngleMax": 42.0,
"bL1aqcCleanSunAngle": 1,
Expand Down Expand Up @@ -92,7 +92,6 @@
"fL1aqcLTMinMaxBandLight": null,
"fL1aqcAnomalyStep": 20,
"bL1bGetAnc": 1,
"bL1bObpgCreds": 0,
"fL1bDefaultWindSpeed": 5.0,
"fL1bDefaultAOD": 0.2,
"fL1bDefaultSalt": 38.0,
Expand Down Expand Up @@ -148,7 +147,6 @@
"seaBASSHeaderFileName": "sample_SEABIRD_pySAS.hdr",
"bL2SaveSeaBASS": 1,
"bL2WriteReport": 1,
"bL1b_InterpPlotTimeInterp": 1,
"bL2EnableQualityFlags": 1,
"bL2Prodoc3m": 1,
"bL2Prodkd490": 0,
Expand Down
2 changes: 1 addition & 1 deletion Config/sample_SEABIRD_pySAS.hdr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"rho_correction": "M99",
"NIR_residual_correction": "R06",
"BRDF_correction": "L11",
"comments": "! HyperInSPACE vers = 1.2.7\n! HyperInSPACE Config = sample_SEABIRD_pySAS.cfg\n! Rotator Home Angle = 0.0\n! Rotator Delay = 2.0\n! Pitch/Roll Filter = On\n! Max Pitch/Roll = 5.0\n! Rotator Min/Max Filter = On\n! Rotator Min = -126.0\n! Rotator Max = 42.0\n! Rel Azimuth Filter = On\n! Rel Azimuth Min = 90.0\n! Rel Azimuth Max = 135.0\n! Deglitch Filter = On\n! ES Dark Window = 11\n! ES Light Window = 5\n! ES Dark Sigma = 3.2\n! ES Light Sigma = 2.3\n! LI Dark Window = 11\n! LI Light Window = 5\n! LI Dark Sigma = 3.3\n! LI Light Sigma = 3.0\n! LT Dark Window = 11\n! LT Light Window = 13\n! LT Dark Sigma = 3.2\n! LT Light Sigma = 2.7\n! FRM Pathway = FRM-Full-Characterization\n! Wavelength Interp Int = 3.3\n! Max Wind = 10.0\n! Min SZA = 20.0\n! Max SZA = 60.0\n! Spectral Filter = On\n! Filter Sigma Es = 5.0\n! Filter Sigma Li = 8.0\n! Filter Sigma Lt = 3.0\n! Meteorological Filter = On\n! Cloud Flag = 1.0\n! Es Flag = 2.0\n! Dawn/Dusk Flag = 1.0\n! Rain/Humidity Flag = 1.095\n! Ensemble Interval = 300\n! Percent Lt Filter = On\n! Percent Light = 10.0\n! Remove Negatives = On",
"comments": "! HyperInSPACE vers = 1.2.9\n! HyperInSPACE Config = sample_SEABIRD_pySAS.cfg\n! Rotator Home Angle = 0.0\n! Rotator Delay = 2.0\n! Pitch/Roll Filter = On\n! Max Pitch/Roll = 5.0\n! Rotator Min/Max Filter = Off\n! Rotator Min = -126.0\n! Rotator Max = 42.0\n! Rel Azimuth Filter = On\n! Rel Azimuth Min = 90.0\n! Rel Azimuth Max = 135.0\n! Deglitch Filter = On\n! ES Dark Window = 11\n! ES Light Window = 5\n! ES Dark Sigma = 3.2\n! ES Light Sigma = 2.3\n! LI Dark Window = 11\n! LI Light Window = 5\n! LI Dark Sigma = 3.3\n! LI Light Sigma = 3.0\n! LT Dark Window = 11\n! LT Light Window = 13\n! LT Dark Sigma = 3.2\n! LT Light Sigma = 2.7\n! FRM Pathway = FRM-Full-Characterization\n! Wavelength Interp Int = 3.3\n! Max Wind = 10.0\n! Min SZA = 20.0\n! Max SZA = 60.0\n! Spectral Filter = On\n! Filter Sigma Es = 5.0\n! Filter Sigma Li = 8.0\n! Filter Sigma Lt = 3.0\n! Meteorological Filter = On\n! Cloud Flag = 1.0\n! Es Flag = 2.0\n! Dawn/Dusk Flag = 1.0\n! Rain/Humidity Flag = 1.095\n! Ensemble Interval = 300\n! Percent Lt Filter = On\n! Percent Light = 10.0\n! Remove Negatives = On",
"other_comments": "!\n! COMMENTS\n!\n! FRM4SOC-2 Field InterComparison Experiment (FICE)\n! July 11 - 21, 2022\n! Acqua Alta Oceanographic Tower (AAOT), CNR-ISMAR\n!\n! Ancillary data from: % https://www.comune.venezia.it/content/3-piattaforma-ISMAR-CNR\n! and field notes. relAz refers to target relative azimuth in pySAS.\n!\n! Home",
"missing": -9999,
"delimiter": "comma"
Expand Down
1 change: 0 additions & 1 deletion Config/sample_TRIOS_NOTRACKER.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"seaBASSHeaderFileName": "sample_TRIOS_NOTRACKER.hdr",
"bL2SaveSeaBASS": 1,
"bL2WriteReport": 1,
"bL1b_InterpPlotTimeInterp": 1,
"bL2EnableQualityFlags": 1,
"bL2Prodoc3m": 0,
"bL2Prodkd490": 0,
Expand Down
2 changes: 1 addition & 1 deletion Config/sample_TRIOS_NOTRACKER.hdr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"rho_correction": "M99",
"NIR_residual_correction": "R06",
"BRDF_correction": "L11",
"comments": "! HyperInSPACE vers = 1.2.7\n! HyperInSPACE Config = sample_TRIOS_NOTRACKER.cfg\n! Rotator Home Angle = 0.0\n! Rotator Delay = 2.0\n! Pitch/Roll Filter = Off\n! Max Pitch/Roll = 5.0\n! Rotator Min/Max Filter = Off\n! Rotator Min = -40.0\n! Rotator Max = 40.0\n! Rel Azimuth Filter = On\n! Rel Azimuth Min = 90.0\n! Rel Azimuth Max = 135.0\n! Deglitch Filter = Off\n! ES Dark Window = 11\n! ES Light Window = 5\n! ES Dark Sigma = 3.2\n! ES Light Sigma = 2.3\n! LI Dark Window = 11\n! LI Light Window = 5\n! LI Dark Sigma = 3.3\n! LI Light Sigma = 3.0\n! LT Dark Window = 11\n! LT Light Window = 13\n! LT Dark Sigma = 3.2\n! LT Light Sigma = 2.7\n! FRM Pathway = FRM-Full-Characterization\n! Wavelength Interp Int = 3.3\n! Max Wind = 10.0\n! Min SZA = 20.0\n! Max SZA = 60.0\n! Spectral Filter = On\n! Filter Sigma Es = 5.0\n! Filter Sigma Li = 8.0\n! Filter Sigma Lt = 3.0\n! Meteorological Filter = On\n! Cloud Flag = 1.0\n! Es Flag = 2.0\n! Dawn/Dusk Flag = 1.0\n! Rain/Humidity Flag = 1.095\n! Ensemble Interval = 300\n! Percent Lt Filter = On\n! Percent Light = 10.0\n! Remove Negatives = On",
"comments": "! HyperInSPACE vers = 1.2.9\n! HyperInSPACE Config = sample_TRIOS_NOTRACKER.cfg\n! Rotator Home Angle = 0.0\n! Rotator Delay = 2.0\n! Pitch/Roll Filter = Off\n! Max Pitch/Roll = 5.0\n! Rotator Min/Max Filter = Off\n! Rotator Min = -40.0\n! Rotator Max = 40.0\n! Rel Azimuth Filter = On\n! Rel Azimuth Min = 90.0\n! Rel Azimuth Max = 135.0\n! Deglitch Filter = Off\n! ES Dark Window = 11\n! ES Light Window = 5\n! ES Dark Sigma = 3.2\n! ES Light Sigma = 2.3\n! LI Dark Window = 11\n! LI Light Window = 5\n! LI Dark Sigma = 3.3\n! LI Light Sigma = 3.0\n! LT Dark Window = 11\n! LT Light Window = 13\n! LT Dark Sigma = 3.2\n! LT Light Sigma = 2.7\n! FRM Pathway = FRM-Full-Characterization\n! Wavelength Interp Int = 3.3\n! Max Wind = 10.0\n! Min SZA = 20.0\n! Max SZA = 60.0\n! Spectral Filter = On\n! Filter Sigma Es = 5.0\n! Filter Sigma Li = 8.0\n! Filter Sigma Lt = 3.0\n! Meteorological Filter = On\n! Cloud Flag = 1.0\n! Es Flag = 2.0\n! Dawn/Dusk Flag = 1.0\n! Rain/Humidity Flag = 1.095\n! Ensemble Interval = 300\n! Percent Lt Filter = On\n! Percent Light = 10.0\n! Remove Negatives = On",
"other_comments": "!\n! Sample dataset for TriOS triplet with no GPS or sun tracker.\n! FRM4SOC-2 Field InterComparison Experiment (FICE)\n! July 11 - 21, 2022\n! Acqua Alta Oceanographic Tower (AAOT), CNR-ISMAR\n! \n! RelAz refer to solar-sensor relative azimuth angle.\n! Manually operated TriOS triplet. Height: ~15 m, Tower color: Red/yellow.\n!",
"missing": -9999,
"delimiter": "comma"
Expand Down
Binary file added Data/Img/ECMWF_ADS_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Data/Img/ECMWF_CDS_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Data/Img/EUMETSAT_Data_Store_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Data/Img/NASA_Earth_Data_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 38 additions & 67 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys
import time
from PyQt5 import QtCore, QtGui, QtWidgets
from PIL import Image, ImageTk

# import requests
# from tqdm import tqdm
Expand All @@ -25,12 +26,12 @@
from Source.Controller import Controller
from Source.ConfigFile import ConfigFile
from Source.ConfigWindow import ConfigWindow
from Source.GetAnc import GetAnc
import Source.GetAnc_credentials as credentials
from Source.SeaBASSHeader import SeaBASSHeader
from Source.SeaBASSHeaderWindow import SeaBASSHeaderWindow
from Source.Utilities import Utilities

VERSION = "1.2.8"
VERSION = "1.2.9"


class Window(QtWidgets.QWidget):
Expand All @@ -44,6 +45,13 @@ def __init__(self, parent=None):
super().__init__(parent)
# self.setStyleSheet("background-color: #e3e6e1;")

icon_path = os.path.join(os.path.dirname(__file__), 'Data', 'Img', 'logo.ico')
# load_icon = Image.open(icon_path)
# render = ImageTk.PhotoImage(load_icon) # Loads the given icon
# app.iconphoto(False, render)

self.setWindowIcon(QtGui.QIcon(icon_path))

# Create - if inexistent - directories Plots, Config and Logs
hypercpDirs = ["Plots", "Config", "Logs"]
for directory in hypercpDirs:
Expand All @@ -60,7 +68,6 @@ def __init__(self, parent=None):

def initUI(self):
"""Initialize the user interface"""

# Main window configuration restore
MainConfig.loadConfig(
MainConfig.fileName, VERSION
Expand Down Expand Up @@ -421,21 +428,6 @@ def processSingle(self, lvl):
ConfigFile.loadConfig(configFileName)
seaBASSHeaderFileName = ConfigFile.settings["seaBASSHeaderFileName"]
SeaBASSHeader.loadSeaBASSHeader(seaBASSHeaderFileName)
InstrumentType = ConfigFile.settings["SensorType"]

# To check instrument type
if InstrumentType.lower() == "trios":
flag_Trios = 1
elif InstrumentType.lower() == "seabird":
flag_Trios = 0
else:
print("Error in configuration file: Sensor type not specified")
sys.exit()

# Select data files
# if not self.inputDirectory[0]:
# print("Bad input parent directory.")
# return

if lvl == "L1A":
inLevel = "raw"
Expand Down Expand Up @@ -471,14 +463,17 @@ def processSingle(self, lvl):
print("Process Calibration Files")
calFiles = ConfigFile.settings["CalibrationFiles"]

if flag_Trios == 0:
# if flag_Trios == 0:
calibrationMap = None
if ConfigFile.settings["SensorType"].lower() == "seabird":
calibrationMap = Controller.processCalibrationConfig(
configFileName, calFiles
)
else:
# else:
elif ConfigFile.settings["SensorType"].lower() == "trios":
calibrationMap = Controller.processCalibrationConfigTrios(calFiles)
# calibrationMap = 0
if not calibrationMap.keys():

if not calibrationMap:
print(
"No calibration files found. "
"Check Config directory for your instrument files."
Expand All @@ -490,9 +485,11 @@ def processSingle(self, lvl):
print("Bad output directory.")
return

# Controller.processFilesSingleLevel(
# self.outputDirectory, fileNames, calibrationMap, lvl, flag_Trios
# )
Controller.processFilesSingleLevel(
self.outputDirectory, fileNames, calibrationMap, lvl, flag_Trios
)
self.outputDirectory, fileNames, calibrationMap, lvl)
t1Single = time.time()
print(f"Time elapsed: {str(round((t1Single-t0Single)/60))} minutes")

Expand Down Expand Up @@ -544,8 +541,7 @@ def processMulti(self):
return

openFileNames = QtWidgets.QFileDialog.getOpenFileNames(
self, "Open File", self.inputDirectory
)
self, "Open File", self.inputDirectory)

print("Files:", openFileNames)

Expand All @@ -557,14 +553,11 @@ def processMulti(self):
if not self.outputDirectory:
return

InstrumentType = ConfigFile.settings["SensorType"]
calFiles = ConfigFile.settings["CalibrationFiles"]
# To check instrument type
if InstrumentType.lower() == "trios":
flag_Trios = 1
if ConfigFile.settings["SensorType"].lower() == "trios":
calibrationMap = Controller.processCalibrationConfigTrios(calFiles)
elif InstrumentType.lower() == "seabird":
flag_Trios = 0
elif ConfigFile.settings["SensorType"].lower() == "seabird":
print("Process Calibration Files")
filename = ConfigFile.filename
calibrationMap = Controller.processCalibrationConfig(filename, calFiles)
Expand All @@ -573,8 +566,7 @@ def processMulti(self):
sys.exit()

Controller.processFilesMultiLevel(
self.outputDirectory, fileNames, calibrationMap, flag_Trios
)
self.outputDirectory, fileNames, calibrationMap)
t1Multi = time.time()
print(f"Time elapsed: {str(round((t1Multi-t0Multi)/60))} Minutes")

Expand Down Expand Up @@ -652,19 +644,16 @@ def __init__(

ConfigFile.loadConfig(self.configFilename)

InstrumentType = ConfigFile.settings["SensorType"]
calFiles = ConfigFile.settings["CalibrationFiles"]

if InstrumentType.lower() == "trios":
flag_Trios = 1
if ConfigFile.settings["SensorType"].lower() == "trios":
calibrationMap = Controller.processCalibrationConfigTrios(calFiles)
elif InstrumentType.lower() == "seabird":
flag_Trios = 0
elif ConfigFile.settings["SensorType"].lower() == "seabird":
print("Process Calibration Files")
filename = ConfigFile.filename
calibrationMap = Controller.processCalibrationConfig(filename, calFiles)
else:
print("Error in configuration file: Sensor type not specified")
print(f'CalibrationConfig is not yet ready for {ConfigFile.settings["SensorType"]}')
sys.exit()

# Update the SeaBASS .hdr file in case changes were made to the configuration without using the GUI
Expand All @@ -673,19 +662,16 @@ def __init__(
SeaBASSHeader.saveSeaBASSHeader(ConfigFile.settings['seaBASSHeaderFileName'])

if processMultiLevel:
if InstrumentType.lower() == "trios" and to_level == "L1A":
if ConfigFile.settings["SensorType"].lower() == "trios" and to_level == "L1A":
Controller.processFilesMultiLevel(
self.outputDirectory, iFile, calibrationMap, flag_Trios
)
self.outputDirectory, iFile, calibrationMap)
else:
Controller.processFilesMultiLevel(
self.outputDirectory, [iFile], calibrationMap, flag_Trios
)
self.outputDirectory, [iFile], calibrationMap)
else:
# processSingleLevel is only prepared for a singleton file at a time
Controller.processSingleLevel(
self.outputDirectory, iFile, calibrationMap, to_level, flag_Trios
)
self.outputDirectory, iFile, calibrationMap, to_level)


if __name__ == "__main__":
Expand Down Expand Up @@ -751,22 +737,6 @@ def __init__(
default=None,
type=str,
)
required.add_argument(
"-u",
action="store",
dest="username",
help="Username of the account on https://oceancolor.gsfc.nasa.gov/",
default=None,
type=str,
)
required.add_argument(
"-p",
action="store",
dest="password",
help="Password of the account on https://oceancolor.gsfc.nasa.gov/",
default=None,
type=str,
)

args = parser.parse_args()

Expand Down Expand Up @@ -798,8 +768,6 @@ def __init__(
outputDirectory = args.outputDirectory
level = args.level
ancFile = args.ancFile
username = args.username
password = args.password
multiLevel = args.multiLevel


Expand All @@ -817,12 +785,15 @@ def __init__(
# If the cmd argument is given, run the Command class without the GUI
if cmd:
os.environ["HYPERINSPACE_CMD"] = "TRUE" # Must be a string
if not (args.username is None or args.password is None):
# Only for L2 processing set credentials
GetAnc.userCreds(username, password)

# Pop up credential windows if credentials not stored...
credentials.credentialsWindow('NASA_Earth_Data')
credentials.credentialsWindow('ECMWF_ADS')

Command(configFilePath, inputFile, multiLevel, outputDirectory, level, ancFile)
else:
os.environ["HYPERINSPACE_CMD"] = "FALSE" # Must be a string

app = QtWidgets.QApplication(sys.argv)
win = Window()
sys.exit(app.exec_())
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ retrieval. Data outputs are formatted to text files for submission to the [SeaBA
Currently, HyperCP supports <a href='https://www.seabird.com/'>Sea-Bird Scientific</a> HyperSAS packages with and
without SolarTracker or pySAS robotic platforms as well as [TriOS](https://www.trios.de/en/radiometers.html) used in manual configuration. If you are interested in integrating support for your platform, contact us at the email addresses below or in the Discussions tab of the GitHub repository.

## Version 1.2.8
## Version 1.2.9

```
The MIT license
Expand Down Expand Up @@ -93,6 +93,11 @@ If environment problems are encountered after updating HyperCP (e.g, dependencie
```
conda env update --file environment.yml --prune
```
**NOTE:** If you started with working with v1.2.8 or less and are now in v1.2.9 or higher, you may need to remove the old hypercp environment and reinstall the environment as described above.
```
prompt$ conda deactivate
prompt$ conda remove -n hypercp --all
```

To report a bug, please submit it [here](https://github.com/nasa/HyperCP/issues), the HyperCP Team will take
care of it :). All other support inquiries should be directed to the Discussions board [here](https://github.com/nasa/HyperCP/discussions)
Expand Down
Loading

0 comments on commit a53b354

Please sign in to comment.