All network operations are handled by the pollyxt_pipelines.scc_access module and specifically,
the SCC class. The code is based the work of Ioannis Binietoglou on
SCC Access.
To programmatically access SCC, begin by importing pollyxt_pipelines.scc_access and creating
a SCC_Credentials object.
from pollyxt_pipelines.config import Config
import pollyxt_pipelines.scc_access
# TODO remove dependency on Config
credentials = SCC_Credentials(Config())
Afterwards, you can access SCC as follows:
# As a context
with scc_access.scc_session(credentials) as scc:
# Do stuff with scc
# ...
scc.upload_file(...)
# As a class
scc = scc_access.SCC(credentials)
scc.login()
# ...
The context manager handles login/logout automatically. If you use the class yourself,
you should call login() before attempting to call any other method.
Tools for communicating with the SCC backend
Author: Thanasis Georgiou <ageorgiou@noa.gr>
Based on scc-access by Iannis Binietoglou <i.binietoglou@impworks.gr>: https://repositories.imaa.cnr.it/public/scc_access
Bases: object
Represents a session with SCC.
Before making any calls, the user should login using login()!
It’s recommended to use the scc_session() context manager, which handles logging in and out.
Deletes a measurement from SCC
measurement_id (str) – Which measurement to delete
Downloads a single file from SCC to the given path
url (str) – Which URL to download the file from
path (Path) – Where to store the downloaded file
Downloads products for a given measurement (ID) to the given path. This function is a generator, yielding the filename of each downloaded file.
measurement_id (str) – Which measurement to download products for
download_path (Path) – Where to store the downloaded products
hirelpp – Whether to download HiRELPP files
cloudmask – Whether to download Cloudmask files
elpp – Whether to download ELPP files
optical – Whether to download optical (ELDA or ELDEC) files
elic – Whether to download ELIC files
Uses the SCC API to fetch information about anchillary files.
file_id (str) – File ID to lookup
file_type (str) – What kind of file to lookup (‘sounding’, ‘overlap’ or ‘lidarratio’)
Optional[APIObject]
The API response about the file
Fetches the Lidar constants from SCC
date_start (date) – First day of results
date_end (date) – Last day of results
location (Optional[Location]) – Optionally, filter results by a location
page – Which page to return (starts from 1, default value is 1)
Tuple[int, List[Measurement]]
The number of pages and the list of measurements
Fetches information about one measurement from SCC.
measurement_id (str) – Which measurement to lookup
Optional[Measurement]
The measurement if it exists, None otherwise
Login to SCC
This function starts a session with the SCC backend, storing the authentication
cookies so they can be used by the rest of the methods. Remember to call logout()!
Searches SCC for uploaded measurements
date_start (date) – First day of results
date_end (date) – Last day of results
location (Optional[Location]) – Optionally, filter results by a location
page – Which page to return (starts from 1, default value is 1)
Tuple[int, List[Measurement]]
The number of pages and the list of measurements
Asks SCC to re-run processing routines for a given measurement ID
measurement_id (str) – Which measurement to re-run
Uploads a file to SCC, together with the auxilary files. There is no return value, but it will throw for potential errors.
filename (Path) – Path to the SCC netCDF file
system_id (str) – SCC Lidar System ID for the system that made the measurement
rs_filename (Optional[Path]) – Path to the radiosonde netCDF file
ov_filename (Optional[Path]) – Path to the overlap netCDF file
lr_filename (Optional[Path]) – Path to the lidar ratio netCDF file
Bases: object
Contains all required credentials to authenticate with SCC
An SCC session as a context, to use with with:
Example:
with scc_access(credentials) as scc:
# Use scc
# ...
Exceptions that might occur while working with SCC
Bases: Exception
Raised when the requested measurement does not exist in the SCC database
Bases: Exception
Raised when a page cannot be accessed
Bases: Exception
Raised when an error message from SCC is parsed from the page body
Various container classes and utility functions for handling SCC responses
Bases: object
SCC generic API response object
The only objects fetched from the API are Anchillary files, so this class doesn’t do much.
Bases: object
Create a measurement object from a table row. Table rows are formatted like in https://scc.imaa.cnr.it/admin/database/lidarconstant/
Bases: object
Create a measurement object from a table row. Table rows are formatted like in https://scc.imaa.cnr.it/admin/database/measurements/
Bases: Enum
Represents the status of a product (ie ELDA) on SCC
Convert a table cell to a bool
bool