GithubHelp home page GithubHelp logo

hypercp's Introduction

HyperInSPACE Community Processor (HyperCP)

Banner

Hyperspectral In situ Support for PACE (HyperInSPACE) Community Processor (HyperCP) is designed to provide hyperspectral support for the PACE mission but also multispectral missions such as Sentinel-3 by processing automated and manual, above-water, hyperspectral ocean color radiometry data using state-of-the-art methods and protocols for quality assurance, uncertainty estimation/propagation, sky/sunglint correction, convolution to satellite wavebands, and ocean color product retrieval. Data outputs are formatted to text files for submission to the SeaBASS and OCDB databases and saved as comprehensive HDF5 records with automated processing reports. The package is designed to facilitate rigorous, flexible, and transparent data processing for the ocean color remote sensing community. Radiometry processed in HyperCP is used for water optical characterization, ocean color product retrieval algorithm development, and orbital platform validation.

Currently, HyperCP supports Sea-Bird Scientific HyperSAS packages with and without SolarTracker or pySAS robotic platforms as well as TriOS 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.2

The MIT license

 Copyright © 2020 United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All Rights Reserved.

 Copyright © 2023 EUMETSAT

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Main author: Dirk Aurin, MSU @ NASA Goddard Space Flight Center [email protected]

Co-authors: Nathan Vandenberg @ UVictoria, Maycira Costa @ UVictoria (in the frame of PySciDON), Alexis Deru @ ACRI-ST, Ashley Ramsay @ NPL, Agnieszka Bialek @ NPL, Marine Bretagnon @ ACRI-ST (in the frame of Copernicus' FRM4SOC-2), Gabriele Bai @ ACRI-ST, Juan Ignacio Gossn @ EUMETSAT, Nils Haentjens @ UMaine

Contact: Discussions tab in GitHub, or Dirk Aurin, MSU @ NASA Goddard Space Flight Center [email protected], and Juan Ignacio Gossn @ EUMETSAT [email protected]

Contents:

Requirements and Installation

1. Get the HyperCP repository

Clone this repository (branch: "master") to a convenient directory on your computer:

prompt$ git clone --depth 1 https://github.com/nasa/HyperCP.git /path/to/convenient/directory

If you are, or plan to be, a HyperCP Team collaborator, or if you are interested in early release branches, drop '--depth 1' from the clone command. If you are unfamiliar with git, simply download and unzip by clicking Code >> Download ZIP - we encourage you to use git though (see why below). A link to bundled executable versions of HyperCP for Windows, MacOS, and Linux will be added soon.

2. Get the HyperCP environment

HyperCP requires Python 3.X installed on a Linux, MacOS, or Windows computer. The Anaconda distribution (or Miniconda) is encouraged. If you are unfamiliar with Anaconda, a nice walkthrough can be found here.

All of the package dependencies are listed in the environment.yml file included with the package. To make sure you have all of the necessary dependencies, navigate to the HyperCP directory on command line, type:

prompt$ conda env create -f environment.yml

and follow the prompts to install the additional package dependencies on your machine within the new virtual environment. When completed you should be in the virtual environment: the prefix (hypercp) before your prompt should appear indicating that the system is properly enabled and ready to run from the terminal.

To return to the environment later before launching the program, type

prompt$ conda activate hypercp

To stay up to date with the latest commits to the master branch, it is strongly recommended that you pull them prior to using the software. From the HyperCP directory, type:

(hypercp) prompt$ git pull

[If, instead, you are not using git you should regularly re-download and unzip the repository or the bundled executable version to ensure you are using the latest version of the software].

If environment problems are encountered after updating HyperCP (e.g, dependencies are not found), try updating the environment (after activating hypercp) using:

conda env update --file environment.yml --prune

To report a bug, please submit it here, the HyperCP Team will take care of it :). All other support inquiries should be directed to the Discussions board here

3. Launch HyperCP for the first time!

To finalize and test the set-up, let's launch HyperCP for the first time: navigate to the project folder on the command line and type:

(hypercp) prompt$ python Main.py

A GUI window should pop up, looking approximately like this:

banner

When HyperCP/Main.py is launched for the first time, sub-directories will be created and databases downloaded and moved into them as described below. No system files will be changed.

3.1 Directories (created after first launch)

  • Config: Configuration and instrument files (by subdirectory - auto-created), SeaBASS header configuration files, main view configuration file.
  • Logs: Most command line output messages generated during processing are captured for later reference in .log text files here.
  • Plots: A variety of optional plotting routines are included which create sub-directories (i.e. 'L1AQC_Anoms', 'L1B_Interp', 'L2_Spectral_Filter', 'L2', 'L2_Products').
  • Data: This directory now comes unpacked in the distribution. By default, it contains only files for seawater absorption properties, top-of-atmosphere solar irradiance, satellite sensor spectral response functions, banner images for the GUI, and the Zhang glint correction database (see Database Download below). This is also the optional fallback location for input and/or output radiometry data, though using separate locations for field data is recommended.
  • Source: This directory (which comes unpacked with the distribution) holds the majority of the Python source code.

3.2 Database (downloaded after first launch)

  • Zhang skyglint correction database: This (~ 2.3 GB) database will be optionally used for the glint correction based on the method of Zhang et al., 2017, OE, 25(4)). It will stored at /Data/Zhang_rho_db.mat. If this download should fail for any reason, further instructions will be given at the command line terminal where Main.py was launched.

Usage

If you followed Requirements and Installation successfully, you are ready to start using HyperCP!

banner

Quick Start Overview

  1. Identify the research cruise, relevant calibration files, and ancillary data files to be used in processing.
  2. Launch HyperCP and set up the Main Window for data directories and the ancillary file
  3. Create a new Configuration (or edit an existing Configuration)
  4. Add and enable only relevant calibration and instrument files to the Configuration; there is no such thing as a standard instrument package
  5. Choose appropriate processing parameters for L1A-L2 (do not depend on software defaults; there is no such thing as a standard data collection)
  6. HDF5 files will be produced at each level of processing, plus optional SeaBASS text files for radiometry at L2. Plots can be produced at L1AQC, L1B, and L2. Processing logs and plots are aggregated into optional PDF Reports at L2 (covering all processing from RAW to L2) written to a dedicated Reports directory in the selected Output directory.

Main Window: Description

HyperCP is a Main-View-Controller Python package with a GUI that can be launched in several ways. However you launch the GUI, watch for important feedback at the command line terminal in addition to informational GUI windows. Batching multiple files across single or multiple processing levels is also possible as described below.

The Main window appears once Main.py is launched, as described above:

(hypercp) prompt$ python Main.py

The GUI's main window is divided into four main sections, each with options to specify:

  1. A configuration file
  2. Input/output directories
  3. Ancillary input files
  4. Single-level processing
  5. Multi-level processing

Pop-up windows for failed processing (i.e, no output data due to either corrupt raw data or stringent quality control filtering) files can be suppressed using the check box. No output file at a given processing level is often a normal result of quality control filtering, so checking this box allows batches to continue uninterrupted (or frees the core if multi-core processing via command line).

NB: Your Main window set up (including configuration file, Input/Output directories, and Ancillary File) will be saved automatically in Config/main.config and reopened the next time you launch Main.py.

1. Configuration Section

The configuration section in the Main window involves setting the correct config (.cfg) file, which in turn includes details of which processing parameters and calibration/characterisation files will be used to run HyperCP.

You will need to read the Configuration README to learn how to set your configuration file appropriately.

  1. The 'New' button allows creation of a new configuration file.
  2. 'Edit' allows editing the currently selected configuration file.
  3. 'Delete' is used to delete the currently selected configuration file and corresponding auto-created calibration directories.

After creating a new configuration file, select it from the drop-down menu, and select 'Edit' to launch the Configuration module GUI.

2. Input/Output Directories

It will be helpful to set your 'Input Data' and 'Output Data' directories from the Main window. As an example, one could use a cruise directory containing RAW HyperSAS data as the Input Parent Directory, and then create another directory to use as the Output Parent Directory when processing from L0 (raw binary). Inside the Output Parent Directory, files will be automatically sorted by processing level in the automatically created sub-directories (i.e. the software automatically creates and looks for L1A, L1AQC, L1B, L1BQC, and L2 directories under the parent directory). If not selected, the Input/Output parent directories will default to the /Data directory within HyperCP.

The 'Input...' and 'Output Data/Plots Parent Directory' buttons are self explanatory and allow optional selection of data and directories from any mounted/mapped drive. Note that output data and plot sub-directories (e.g. for processing levels) are also auto-created during processing as described below. The parent directory is the directory containing the sub-directories for processing levels (e.g. "/L1A", "/L1B", etc.) If no input or output data directories are selected, '/Data' and '/Plots' under the HyperCP directory structure will be used by default as the parent directories.

3. Ancillary Input Files

Ancillary data files for environmental conditions and relevant geometries used in processing must be text files in SeaBASS format with columns for date, time, lat, and lon. For a description of the SeaBASS format see this.

Optional data fields in the SeaBASS format include

  • station number,
  • ship heading,
  • ship speed,
  • relative sensor azimuth,
  • aerosol optical depth,
  • cloud cover,
  • salinity,
  • water temperature,
  • wind speed.

Example ancillary files are included in /Data/Sample_Data for use as a template. It is recommended that ancillary files are checked with the FCHECK utility as described here. They will be interpreted using the included SB_support.py module from NASA/OBPG.

In case environmental conditions were not logged in the field, or for filling in gaps in logged data, they will be retrieved from GMAO or ECMWF models as described below. The ancillary data file is optional (though strongly advised for adding wind speed at a minimum) provided the sensor suite is equipped with a SolarTracker, pySAS, or equivalent to supply the relevant sensor/solar geometries combined with a GPS for position and time. If no SolarTracker-type instrument is present to report the relative sensor/solar geometries, the ancillary file must be provided with at least the ship heading and relative angle between the bow of the ship and the sensor azimuth as a function of time (see sample "NOTRACKER" configuration provided). If no GPS is present, position and time are also required in an ancillary file. Application of the Zhang et al. (2017) glint correction will require the addition of GMAO or ECMWF model data for aerosol optical depth.

4. Single-level Processing

HyperCP's workflow follows processing levels from L0 to L2, resembling satellite processing levels. In this section you can execute each of the processors that take you from one processing level to the next individually.

A file selection dialogue will appear. Multiple data files can be processed together (successively) by simply selecting them together in the GUI (e.g. Shift- or Ctrl- click, or Ctrl-A for all, depending on your platform). Input files will be checked for matching expected input level (e.g. L1AQC file input for for L1B processing will raise an error).

5. Multi-level Processing

Multi-level processing works the same as single-level by processing each input raw file through all levels before moving on to the next raw file. However, it will only continue with a given file if the preceding level was created immediately (within 1 minute) prior. In other words, if -- due to changes in QA/QC parameterization -- a file is entirely discarded at a given level, but an old file of the same name still exists in that directory, it will be ignored, and processing for that file will be terminated for higher levels.

Processing workflow overview

Banner

Level 1A through Level 2 processing configurations are adjusted in the Configuration window. If you are reading this for the first time, opening the Configuration Window is a good reference to accompany the discussion here regarding processing.

  • Level 1A Processing: Process data from raw binary (Satlantic HyperSAS '.RAW' collections) to L1A (Hierarchical Data Format 5 '.hdf'). Calibration files and the RawFileReader.py script allow for interpretation of raw data fields, which are read into HDF objects.
  • Level 1AQC Processing: Data are filtered for vessel attitude (pitch, roll, and yaw when available), viewing and solar geometry.
  • Level 1B Processing: Dark current corrections are applied followed by instrument calibrations and then matching of timestamps and wavebands for all radiometers in the suite.
  • Level 1BQC Processing: Further quality control filters are applied to data prior to L2 ensemble binning and reflectance calculation.
  • Level 2 Processing: Data are averaged within optional time interval ensembles prior to calculating the remote sensing reflectance within each ensemble.

Executing HyperCP from the command line

There is a command line option for batching a single level which can be triggered by adding the -cmd argument:

(hypercp) prompt$ python Main.py -c config -i inputFile -o outputDirectory -l processingLevel

where config is the configuration file, and the other arguments are self-explanatory (processingLevel should be in all caps, e.g., L1AQC). An example script has been provided (run_sample.py) for batching files using the command line option.

References

  • Abe, N., B. Zadrozny and J. Langford (2006). Outlier detection by active learning. Proceedings of the 12th ACM SIGKDD international conference on Knowledge discovery and data mining. Philadelphia, PA, USA, Association for Computing Machinery: 504–509.
  • Brewin, R. J. W., G. Dall'Olmo, S. Pardo, V. van Dongen-Vogels and E. S. Boss (2016). "Underway spectrophotometry along the Atlantic Meridional Transect reveals high performance in satellite chlorophyll retrievals." Remote Sensing of Environment 183: 82-97.
  • Burggraaff, O. (2020). "Biases from incorrect reflectance convolution." Optics Express 28(9): 13801-13816.
  • Chandola, V., A. Banerjee and V. Kumar (2009). "Anomaly detection: A survey." ACM Comput. Surv. 41(3): Article 15.
  • Coddington, O. M., Richard, E. C., Harber, D., Pilewskie, P., Woods, T. N., Chance, K., et al. (2021). The TSIS-1 Hybrid Solar Reference Spectrum. Geophysical Research Letters, 48, e2020GL091709. https://doi.org/10.1029/2020GL091709
  • D’Alimonte, D. and T. Kajiyama (2016). "Effects of light polarization and waves slope statistics on the reflectance factor of the sea surface." Optics Express 24(8): 7922-7942.
  • Foster, R. and A. Gilerson (2016). "Polarized transfer functions of the ocean surface for above-surface determination of the vector submarine light field." Applied Optics 55(33): 9476-9494.
  • Garaba, S. P., J. Schulz, M. R. Wernand and O. Zielinski (2012). "Sunglint Detection for Unmanned and Automated Platforms." Sensors 12(9): 12545.
  • Gilerson, A., C. Carrizo, R. Foster and T. Harmel (2018). "Variability of the reflectance coefficient of skylight from the ocean surface and its implications to ocean color." Optics Express 26(8): 9615-9633.
  • Harmel, T., A. Gilerson, A. Tonizzo, J. Chowdhary, A. Weidemann, R. Arnone and S. Ahmed (2012). "Polarization impacts on the water-leaving radiance retrieval from above-water radiometric measurements." Applied Optics 51(35): 8324-8340.
  • Hieronymi, M. (2016). "Polarized reflectance and transmittance distribution functions of the ocean surface." Optics Express 24(14): A1045-A1068.
  • Hooker, S. B., G. Lazin, G. Zibordi and S. McLean (2002). "An Evaluation of Above- and In-Water Methods for Determining Water-Leaving Radiances." Journal of Atmospheric and Oceanic Technology 19(4): 486-515.
  • Hooker, S. B. and A. Morel (2003). "Platform and Environmental Effects on Above-Water Determinations of Water-Leaving Radiances." Journal of Atmospheric and Oceanic Technology 20(1): 187-205.
  • Lee, Z., Y.-H. Ahn, C. Mobley and R. Arnone (2010). "Removal of surface-reflected light for the measurement of remote-sensing reflectance from an above-surface platform." Optics Express 18(25): 26313-26324.
  • Mobley, C. D. (1999). "Estimation of the remote-sensing reflectance from above-surface measurements." Applied Optics 38(36): 7442-7455.
  • Mobley, C. D. (2015). "Polarized reflectance and transmittance properties of windblown sea surfaces." Applied Optics 54(15): 4828-4849.
  • Mueller, J. L., A. Morel, R. Frouin, C. O. Davis, R. Arnone, K. L. Carder, Z. P. Lee, R. G. Steward, S. B. Hooker, C. D. Mobley, S. McLean, B. Holbert, M. Miller, C. Pietras, K. D. Knobelspiesse, G. S. Fargion, J. Porter and K. J. Voss (2003). Ocean Optics Protocols for Satellite Ocean Color Sensor Validation, Revision 4, Volume III. Ocean Optics Protocols for Satellite Ocean Color Sensor Validation. J. L. Mueller. Greenbelt, MD, NASA Goddard Space Flight Center.
  • Ruddick, K., V. De Cauwer and B. Van Mol (2005). Use of the near infrared similarity reflectance spectrum for the quality control of remote sensing data, SPIE.
  • Ruddick, K. G., V. De Cauwer, Y.-J. Park and G. Moore (2006). "Seaborne measurements of near infrared water-leaving reflectance: The similarity spectrum for turbid waters." Limnology and Oceanography 51(2): 1167-1179.
  • Simis, S.G.H., J. Olsson (2013). "Unattended processing of shipborne hyperspectral reflectance measurements." Remote Sensing of Environment, Volume 135.
  • Vandenberg, N., M. Costa, Y. Coady and T. Agbaje (2017). PySciDON: A python scientific framework for development of ocean network applications. 2017 IEEE Pacific Rim Conference on Communications, Computers and Signal Processing (PACRIM).
  • Wernand, M. R. (2002). GUIDELINES FOR (SHIP BORNE) AUTO-MONITORING OF COASTAL AND OCEAN COLOR. Ocean Optics XVI. S. Ackleson and C. Trees. Santa Fe, NM, USA.
  • Zhang, X., S. He, A. Shabani, P.-W. Zhai and K. Du (2017). "Spectral sea surface reflectance of skylight." Optics Express 25(4): A1-A13.
  • Zibordi, G., S. B. Hooker, J. F. Berthon and D. D'Alimonte (2002). "Autonomous Above-Water Radiance Measurements from an Offshore Platform: A Field Assessment Experiment." Journal of Atmospheric and Oceanic Technology 19(5): 808-819.
  • Zibordi, G., F. Mélin, J.-F. Berthon, B. Holben, I. Slutsker, D. Giles, D. D’Alimonte, D. Vandemark, H. Feng, G. Schuster, B. E. Fabbri, S. Kaitala and J. Seppälä (2009). "AERONET-OC: A Network for the Validation of Ocean Color Primary Products." Journal of Atmospheric and Oceanic Technology 26(8): 1634-1651.
  • Zibordi, G., K. J. Voss, B. Johnson and J. L. Mueller (2019). Protocols for Satellite Ocean Colour Data Validation: In Situ Optical Radiometry. IOCCG Ocean Optics and Biogeochemistry Protocols for Satellite Ocean Colour Sensor Validation. IOCCG. Dartmouth, NS, Canada, IOCCG.

hypercp's People

Contributors

alexdeathway avatar alexisderu avatar aramsay17 avatar doizuc avatar oceancolorcoder avatar snoyes avatar tkantz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

hypercp's Issues

pySAS FRM-Full L2 fail

Error in L2 process:
File "/mount/internal/work-st/projects/tartu-1281/FRM4SOCv2/workspace/aderu/miniconda3/envs/hypercp/lib/python3.11/site-packages/comet_maths/random/generate_sample.py", line 262, in generate_sample_random
sample = sample_pdf * u_param[sli_par] + param[sli_par]
ValueError: operands could not be broadcast together with shapes (100,255) (1,165)

Something to do with a missing transpose...
@aramsay, @AlexisDeru

Demo the Issue-Fork-Branch-PR

This issue is to demonstrate the process of submitting an Issue, Forking, creating a development Branch, and submitting a Pull Request (PR). The "fix" will involve demonstrating each of these steps and it will be testing by completing them according to the Guidelines.

Minor Improvements

Minor improvements
+ Update run as python package:
+ Added example on how to run multiple instances from command line (run.py)
+ Added environment variable HYPERINSPACE_CMD
+ Prevent showing error window when running in command line (error still show in standard output and logs)
+ Answered question in Main.py regarding error with pylint and dependencies: major refactoring is required which would improve the behaviour of the code when used as a python package instead of with the GUI
+ Removed unnecessary dependencies in OCproductsWindow, ProcessL2, Utilities
+ Improve row deletion of hdf files in Process L1aqc, ProcessL2, Utilities

Zhang method fail in L2 processing

Error when running Zhang instead of Mobley.
Happens at L2 processing:

File "/mount/internal/work-st/projects/tartu-1281/FRM4SOCv2/workspace/aderu/nasa/HyperInSPACE/Source/ProcessL2.py", line 1616, in ensemblesReflectance
rhoVector, rhoUNC = RhoCorrections.ZhangCorr(WINDSPEEDXSlice,AODXSlice, CloudXSlice, SZAXSlice, SSTXSlice,

File "/mount/internal/work-st/projects/tartu-1281/FRM4SOCv2/workspace/aderu/nasa/HyperInSPACE/Source/RhoCorrections.py", line 170, in ZhangCorr
rhoDelta = Propagate.zhangWrapper(mean_vals=varlist, uncertainties=ulist,

TypeError: Propagate.zhangWrapper() got an unexpected keyword argument 'mean_vals'

HyperCP updates to README, Guidelines, Changelog, License, etc.

To bring HyperCP into compliance with the agreed-upon guidelines, the language of the following files needs to be updated or added to the frm4soc2 branch:

README.md
HyperCP-Collaboration_Guidelines.md
Changelog.md
LICENSE.txt

Additional language for the README may be needed from NPL and ACRI for updates to instructions regarding end-to-end uncertainties and TriOS implementation.

Py6S.sixs_exceptions.ExecutionError: 6S executable not found

Occasionally, when running HyperCP in VSCode, this error is triggered in L1AQC->L1B processing. The problem appears to be that -- for whatever reason -- VSCode did not activate the hypercp environment properly (even though it appeared to and every other dependency is found). Shutting down HyperCP and restarting it appears to resolve the issue.

Similar issues were reported with Py6S here:
robintw/Py6S#52

TriOS Factory (7a97d7c)

File "/Users/daurin/GitRepos/HyperCP/Source/ProcessL2.py", line 1718, in ensemblesReflectance
xUNC = instrument.factory(node, uncGroup,
^^^^^^^^^^^^^^^^^^
AttributeError: 'Trios' object has no attribute 'factory'. Did you mean: 'Factory'?

Z17 pySAS Factory

File "/Users/daurin/GitRepos/HyperCP/Source/ProcessInstrumentUncertainties.py", line 209, in Factory
radcal_cal = pd.DataFrame(uncGrp.getDataset(sensor + "_RADCAL_CAL").data)['2']
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'data'

IMKClient Stall detected

Pesky new error message pops up frequently after upgrade to macOS Ventura 13.4

2023-06-09 10:11:30.284 python[10409:3541769] IMKClient Stall detected, please Report your user scenario attaching a spindump (or sysdiagnose) that captures the problem - (imkxpc_bundleIdentifierWithReply:) block performed very slowly (2.74 secs).

Easy to reproduce, but difficult to track to a cause or troubleshoot. Appears harmless, but annoying.

Class-based cals L1B

L1B pathway for class-based characterization and calibration is incomplete for SeaBird. For TriOS, this path is coded to do the same thing as factory calibration (is this intentional?)

specify precision for degree/decimal conversion

https://github.com/nasa/HyperInSPACE/blob/951206f742dd280db7f8d4ad2722bdce6f55a2c5/Source/Utilities.py#L177-L193

It is reasonable to expect that ddToDm(dmToDd(n)) == n for all n. However, for n = 31 (that is, 0 degrees 31 minutes), this equality does not hold because of the inexact nature of floating point numbers - the value differs from expected by 3.5e-15 (it may depend on hardware and implementation). Curiously, this behavior does not occur for <anything other than 0> degrees 31 minutes.

I recommend that dmToDd accept an optional precision parameter (defaulting to, say, 3 or 6 decimal places) and round the results accordingly.

Add 3C glint correction

Philipp M. M. Groetsch, Peter Gege, Stefan G. H. Simis, Marieke A. Eleveld, and Steef W. M. Peters, "Validation of a spectral correction procedure for sun and sky reflections in above-water reflectance measurements," Opt. Express 25, A742-A761 (2017).

PG to adapt in python to L2 processing in module called by ProcessL2.py>RhoCorrections.py. Uncertainty analysis to follow separately.

Add BRDF uncertainties

Based on today's discussion, these uncertainties are known, but have not been rolled in. Hopefully we can incorporate these also by next week for the merge to master.

@ARamsay17

L1B py6S error

ProcessL1B_FRMCal.py throws an error on call (near line 69):

wavelengths, res = Py6S.SixSHelpers.Wavelengths.run_wavelengths(s, 1e-3*wvl)

TypeError: only size-1 arrays can be converted to Python scalars

Consider docker distribution

It may be more user friendly to use a Docker to contain the code for distribution to avoid conda environment issues.

Datetime x-axis broken in Anomaly Analysis tool

Utilities.plotRadiometry is called by ProcessL1aqc_deglitch.py and AnomalyDetection.realTimePlot used to be able to project the x-axes in Light and Dark plots onto a datetime rather than serial number using matplotlib. Updates to the environment have broken this feature, and it was reverted to serial, which makes cross-referencing Light/Dark difficult.

AnomalyDetection.plotButtonPressed > Utilities.saveDeglitchPlots still exports to PNG with datetime x-axes.

New environment.yml still causing issue on some Nix systems

On Ubuntu 20.04.6 LTS (but not all of them) and conda 23.3.1, using environment.yml fe65804

(test) daurin@gs616-analysis702:~/GitRepos/HyperInSPACE$ python Main.py
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, webgl, xcb.

TriOS Factory L2 fail

TriOS in Factory pathway fails when trying to plot nLw, because nLw_HYPER_unc has 139 np.arrays (one for each waveband), but each array has 194 values instead of 1 value for the uncertainty in nLw in that band.

Ir/radiances and Rrs all have _unc datasets set to all zeroes. nLw does not output nLw_HYPER_unc.

ECMWF error

dev branch

GetAnc_ecmwf.EAC4_download_ensemble returns error "EAC4 atmospheric data could not be retrieved. Check inputs."

Currently called in L1BQC, but soon to be moved to L1B.

Speed up computation of rho with Zhang et al. 2017

Speedup computation of rho with Zhang et al. 2017
+ Improved performance of get_prob x1.5
+ Added cache:
+ Keep LUT from Zhang et al. 2017 loaded in memory
+ Round environmental parameters and added lru_cache on get_prob
+ Replaced interpn from xarray by scipy function for increased speed
+ Added option to run interpn by chunks for datasets exceeding CPU cache (still room for improvements)
+ Limited use of xarray to only reading matlab file, all arrays are with numpy
+ Replaced OrderedDict by normal Dictionary as since python 3.6 Dictionary are ordered and code didn't require data to be ordered.
+ Updated vector direction to avoid unnecessary 2D arrays and have matrix shapes closer to the original matlab code
=> Committed code is up to 9x faster than past code on macBook Pro 2019 with Intel i9 CPU

Propagated L1AQC data filtering and units

L1AQC data propagated to L2 for uncertainties have calibrations applied in error.

Need to confirm propagated L1AQC are filtered the same as other groups in L1BQC and L2 (they should be).

ProcessInstrumentUncertainties.py TriOS FRM-Class

Fails on similar broadcast error to SeaBird, but at a different location:

File "/Users/daurin/GitRepos/HyperCP/Source/ProcessL2.py", line 1690, in ensemblesReflectance
xSlice.update(instrument.Default(uncGroup, stats)) # update the xSlice dict with uncertianties and samples
File "/Users/daurin/GitRepos/HyperCP/Source/ProcessInstrumentUncertainties.py", line 137, in Default
ES_unc, LI_unc, LT_unc, ES_rel, LI_rel, LT_rel = PropagateL1B.propagate_Instrument_Uncertainty(mean_values,
File "/Users/daurin/GitRepos/HyperCP/Source/Uncertainty_Analysis.py", line 63, in propagate_Instrument_Uncertainty
sensor = self.instruments(mean_vals)
File "/Users/daurin/GitRepos/HyperCP/Source/Uncertainty_Analysis.py", line 185, in instruments
return np.array((ESLIGHT - ESDARK)ESCalESStab
ESLinESStrayEST*ESCos),
ValueError: operands could not be broadcast together with shapes (208,) (10,)

Slow processing of L2 uncertainties

Ideas to pursue:

Reduce the size of Z17 by confining it to protocol geometries (DA).

Build LUTs in lieu of full calculations for given conditions (AR).

FRM Branch Uncertainty Budget

Updates are required to apply proper uncertainty analysis and propagation for FRM branch processing, so that the uncertainties correspond to corrected outputs.

SeaBird Non-FRM Class-based

ProcessL2.ensembleReflectances:

SeaBird in "Factory" mode should calculate class-based uncertainties using class-based RADCAL uncertainties for SeaBird.

@ARamsay17

Revisit f/Q BRDF correction

The Morel & Gentili 1996/2002 f/Q BRDF correction implementation needs attention. Determination of gothic R is ambiguous, and no iteration currently implemented. Implications of scipy spline to hyperspectral f/Q are unclear.

Non-positive definite covariance matrix

When running for SeaBird_noTracker (factory mode), I get several warnings:

Reading : Data/hybrid_reference_spectrum_p1nm_resolution_c2020-09-21_with_unc.nc
/tcenas/proj/ocean/color/conda/miniconda3/envs/hypercp/lib/python3.10/site-packages/comet_maths/linear_algebra/matrix_calculation.py:284: UserWarning: One of the provided covariance matrix is not positivedefinite. It has been slightly changed (maximum difference of 6.467318590049452e-14 percent) to accomodate our method.

Test issue

Test issue for pull request (PR) testing.

Tidy up command line functionality

Need to update how version is passed along to MainConfig
Model Main.Command MainConfig settings after GitLab version that includes a new .config file for command line runs
Clean up run.py to be able to use the sample data provided with the master repo as and example. Rename to run_sample.py and provide guidance in the README on how it can be adapted (and renamed) by the user.

ProcessInstrumentUncertainties.py "mean_values" and "uncertainty"

Near line 116 and 126, it tries to broadcast into lists (mean_values and uncertainty) data from stats with 255 elements with data from Coeff and Cal with 10 elements. resulting in, e.g.:

File "/Users/daurin/GitRepos/HyperCP/Source/ProcessL2.py", line 1690, in ensemblesReflectance
xSlice.update(instrument.Default(uncGroup, stats)) # update the xSlice dict with uncertianties and samples
File "/Users/daurin/GitRepos/HyperCP/Source/ProcessInstrumentUncertainties.py", line 116, in Default
mean_values = [stats['ES']['ave_Light'], ones*stats['ES']['ave_Dark'],
ValueError: operands could not be broadcast together with shapes (10,) (255,)

Full uncertainty budget

Modules are required to incorporate FRM-style full sensor characterization files (individual and class-based) and to propagate associated uncertainties from RAW through Level-2 including improved uncertainty estimates for glint and other corrections/adjustments to the radiometry.

nLw uncertainties

Need to confirm that DA's RSS implementation of F0 uncertainties from Coddingtion TSIS-1 F0 into nLw uncertainties (ProcessL2 L456) conforms.

@ARamsay17

Pre-process L1A-L1AQC when launching Anomaly Analysis

Currently, Anomaly analysis has to open a L1AQC file to evaluate deglitching paramterizations prior to processing to L1AQC. This requires running L1AQC with no deglitching first, then going back and opening it in the AnomAnal tool.

This should open L1A file and process with no deglitching prior to running the tool. Slower, but less confusing and error prone.

L2 uncertainties missing

Running SEABIRD_SOLARTRACKER in the Factory Only pathway calculates uncertainties, as evidenced by the very slow use of Z17 despite running for M99 (i.e., to find the difference and add as an uncertainty contribution), but the L2 files have all zeros for ir/radiance and reflectance _unc datasets, and no nLw_unc dataset.

TriOS calMap broken

I clearly broke the GUI for TriOS cal files when I automated the SeaBird cal file recognition logic.

L1B CosCorr, AOT reorganization

MERRA2 AOT to be imported at beginning of L1B or earlier.

Cosine correction (CosCorr) Py6S computation times need to be reduced. Potentially use time-averaged direct/diffuse ratios. (E.g., use L2 ensemble times of ~300s to reduce Lsky and Es from O(2000) spectra to O(20) after dark correction.) Problem still remains that calibrations are applied prior to timestamp/waveband matching. Possible to move CosCorr to after matching?

Likely two PRs to resolve:
DAA: Move MERRA2 acquisition to begin L1B
AD: Move Py6S CosCorr to end L1B and use ensemble-length averages for direct/diffuse

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.