nvcl_kit package
Submodules
nvcl_kit.cql_filter module
- nvcl_kit.cql_filter.LOG_LVL = 20
Initialise debug level, set to ‘logging.INFO’ or ‘logging.DEBUG’
- nvcl_kit.cql_filter.make_cql_filter(bbox: dict, poly: Polygon) str
- nvcl_kit.cql_filter.make_cql_request(url: str, prov: str, cql_filter: str, max_features: int)
Makes an OGC WFS GetFeature v1.1.0 request using GET and expecting a JSON response Caller can supply a CQL filter
- Parameters:
url – OGC WFS URL
prov – provider e.g. ‘nsw’
cql_filter – CQL filter string e.g. filter by polygon
max_features – maximum number of features to return, if < 1 then all boreholes are returned
- Returns:
list of features, each feature is a dict
nvcl_kit.xml_filter module
- nvcl_kit.xml_filter.LOG_LVL = 20
Initialise debug level, set to ‘logging.INFO’ or ‘logging.DEBUG’
- nvcl_kit.xml_filter.make_poly_coords(bbox: dict, poly: Polygon) str
Converts a bounding box dict to polygon coordinate string
- nvcl_kit.xml_filter.make_polygon_prop(coords: str) str
- nvcl_kit.xml_filter.make_xml_filter(bbox: dict, poly: Polygon) str
Makes an XML filter with optional polygon or bbox constraints Used in OGC WFS v1.0.0 “FILTER” parameter
- nvcl_kit.xml_filter.make_xml_request(url: str, prov: str, xml_filter: str, max_features: int) list
Makes an OGC WFS GetFeature v1.0.0 request using POST and expecting a JSON response This also implements local feature filtering for ‘nvclCollection’ attribute
- Parameters:
url – OGC WFS URL
prov – provider e.g. ‘nsw’
xml_filter – XML filter string e.g. filter by polygon
max_features – maximum number of features to return, if < 1 then all boreholes are returned
- Returns:
list of features, each feature is a dict
- nvcl_kit.xml_filter.pretty_print(xml_str)
nvcl_kit.xml_helpers module
- nvcl_kit.xml_helpers.clean_xml_parse(xml_str)
Filters out badly-formatted XML
- Parameters:
xml_str – XML string to parse
- Returns:
XML ElementTree Element object, it will be empty if there was an error
- nvcl_kit.xml_helpers.parse_dates(ds_child)
Parses dates from ‘<Dataset>’ element
- Parameters:
ds_child – XML children of ‘<Dataset>’ element
- Returns:
dict: keys are ‘modified_date’ and/or ‘created_date’, values are datetime objects if no dates were found then an empty dict is returned
nvcl_kit.wfs_helpers module
- nvcl_kit.wfs_helpers.LOG_LVL = 20
Initialise debug level, set to ‘logging.INFO’ or ‘logging.DEBUG’
- nvcl_kit.wfs_helpers.get_borehole_list(param_obj: SimpleNamespace) tuple[list, bool, bool]
nvcl_kit.constants module
This module contains a class of scalar constants
- class nvcl_kit.constants.Scalar(value)
Bases:
str,EnumEnum class of NVCL Scalars, used as input into functions
- The names of scalar classes have 3 parts; first part is class grouping type, second is the TSA mineral matching technique, third part is wavelength:
Min1,2,3 = 1st, 2nd, 3rd most common mineral type OR Grp1,2,3 = 1st, 2nd, 3rd most common group of minerals
uTSA - user, dTSA - domaining, sTSA = system
V = visible light, S = shortwave IR, T = thermal IR, also known as LWIR (long wavelength infrared)
- Source of most class names: “National Virtual Core Scalars”:
‘sjCLST’ is ‘System justified constrained least squares’ ‘ujCLST’ is ‘User justified constrained least squares’
References:
[Chart](https://drillhole.pir.sa.gov.au/Resources/ISM62.pdf) courtesy of Geological Survey of South Australia (GSSA)
Schodlok, MC, Whitbourn, L, Huntington, J, Mason, P, Green, A, Berman, M, Coward, D, Connor, P, Wright, W, Jolivet, M and Martinez, R 2016, HyLogger-3, a visible to shortwave and thermal infrared reflectance spectrometer system for drill core logging: functional description: Australian Journal of Earth Sciences, v. 63, no. 8, p. 929-940, doi:10.1080/08120099.2016.1231133
- ANY = '*'
- Bound_Water_dTSAS = 'Bound_Water dTSAS'
- Bound_Water_sTSAS = 'Bound_Water sTSAS'
- Bound_Water_uTSAS = 'Bound_Water uTSAS'
- Error_dTSAS = 'Error dTSAS'
- Error_dTSAT = 'Error dTSAT'
- Error_dTSAV = 'Error dTSAV'
- Error_sTSAS = 'Error sTSAS'
- Error_sTSAT = 'Error sTSAT'
- Error_sTSAV = 'Error sTSAV'
- Error_sjCLST = 'Error sjCLST'
- Error_uTSAS = 'Error uTSAS'
- Error_uTSAT = 'Error uTSAT'
- Error_uTSAV = 'Error uTSAV'
- Error_ujCLST = 'Error ujCLST'
- Grp1_dTSAS = 'Grp1 dTSAS'
- Grp1_dTSAT = 'Grp1 dTSAT'
- Grp1_dTSAV = 'Grp1 dTSAV'
- Grp1_sTSAS = 'Grp1 sTSAS'
- Grp1_sTSAT = 'Grp1 sTSAT'
- Grp1_sTSAV = 'Grp1 sTSAV'
- Grp1_sjCLST = 'Grp1 sjCLST'
- Grp1_uTSAS = 'Grp1 uTSAS'
- Grp1_uTSAT = 'Grp1 uTSAT'
- Grp1_uTSAV = 'Grp1 uTSAV'
- Grp1_ujCLST = 'Grp1 ujCLST'
- Grp2_dTSAS = 'Grp2 dTSAS'
- Grp2_dTSAT = 'Grp2 dTSAT'
- Grp2_dTSAV = 'Grp2 dTSAV'
- Grp2_sTSAS = 'Grp2 sTSAS'
- Grp2_sTSAT = 'Grp2 sTSAT'
- Grp2_sTSAV = 'Grp2 sTSAV'
- Grp2_sjCLST = 'Grp2 sjCLST'
- Grp2_uTSAS = 'Grp2 uTSAS'
- Grp2_uTSAT = 'Grp2 uTSAT'
- Grp2_uTSAV = 'Grp2 uTSAV'
- Grp2_ujCLST = 'Grp2 ujCLST'
- Grp3_dTSAT = 'Grp3 dTSAT'
- Grp3_sTSAT = 'Grp3 sTSAT'
- Grp3_sjCLST = 'Grp3 sjCLST'
- Grp3_uTSAT = 'Grp3 uTSAT'
- Grp3_ujCLST = 'Grp3 ujCLST'
- Min1_dTSAS = 'Min1 dTSAS'
- Min1_dTSAT = 'Min1 dTSAT'
- Min1_dTSAV = 'Min1 dTSAV'
- Min1_sTSAS = 'Min1 sTSAS'
- Min1_sTSAV = 'Min1 sTSAV'
- Min1_sjCLST = 'Min1 sjCLST'
- Min1_uTSAS = 'Min1 uTSAS'
- Min1_uTSAT = 'Min1 uTSAT'
- Min1_uTSAV = 'Min1 uTSAV'
- Min1_ujCLST = 'Min1 ujCLST'
- Min2_dTSAS = 'Min2 dTSAS'
- Min2_dTSAT = 'Min2 dTSAT'
- Min2_dTSAV = 'Min2 dTSAV'
- Min2_sTSAS = 'Min2 sTSAS'
- Min2_sTSAT = 'Min2 sTSAT'
- Min2_sTSAV = 'Min2 sTSAV'
- Min2_sjCLST = 'Min2 sjCLST'
- Min2_uTSAS = 'Min2 uTSAS'
- Min2_uTSAT = 'Min2 uTSAT'
- Min2_uTSAV = 'Min2 uTSAV'
- Min2_ujCLST = 'Min2 ujCLST'
- Min3_dTSAT = 'Min3 dTSAT'
- Min3_sTSAT = 'Min3 sTSAT'
- Min3_sjCLST = 'Min3 sjCLST'
- Min3_uTSAT = 'Min3 uTSAT'
- Min3_ujCLST = 'Min3 ujCLST'
- NIL_Stat_dTSAS = 'NIL_Stat dTSAS'
- NIL_Stat_dTSAT = 'NIL_Stat dTSAT'
- NIL_Stat_dTSAV = 'NIL_Stat dTSAV'
- NIL_Stat_sTSAS = 'NIL_Stat sTSAS'
- NIL_Stat_sTSAT = 'NIL_Stat sTSAT'
- NIL_Stat_sTSAV = 'NIL_Stat sTSAV'
- NIL_Stat_uTSAS = 'NIL_Stat uTSAS'
- NIL_Stat_uTSAT = 'NIL_Stat uTSAT'
- NIL_Stat_uTSAV = 'NIL_Stat uTSAV'
- SNR_dTSAS = 'SNR dTSAS'
- SNR_dTSAT = 'SNR dTSAT'
- SNR_dTSAV = 'SNR dTSAV'
- SNR_sTSAS = 'SNR sTSAS'
- SNR_sTSAT = 'SNR sTSAT'
- SNR_sTSAV = 'SNR sTSAV'
- SNR_uTSAS = 'SNR uTSAS'
- SNR_uTSAT = 'SNR uTSAT'
- SNR_uTSAV = 'SNR uTSAV'
- TIR_Results = 'TIR Results'
- TSA_S_Water = 'TSA_S Water'
- TSA_V_Water = 'TSA_V Water'
- TirBkgOffset = 'TirBkgOffset'
- TirDeltaTemp = 'TirDeltaTemp'
- Unbound_Water_dTSAS = 'Unbound_Water dTSAS'
- Unbound_Water_sTSAS = 'Unbound_Water sTSAS'
- Unbound_Water_uTSAS = 'Unbound_Water uTSAS'
- Wt1_dTSAS = 'Wt1 dTSAS'
- Wt1_dTSAT = 'Wt2 sTSAT'
- Wt1_dTSAV = 'Wt1 dTSAV'
- Wt1_sTSAS = 'Wt1 sTSAS'
- Wt1_sTSAT = 'Wt1 uTSAT'
- Wt1_sTSAV = 'Wt1 sTSAV'
- Wt1_sjCLST = 'Wt1 sjCLST'
- Wt1_uTSAS = 'Wt1 uTSAS'
- Wt1_uTSAV = 'Wt1 uTSAV'
- Wt1_ujCLST = 'Wt1 ujCLST'
- Wt2_dTSAS = 'Wt2 dTSAS'
- Wt2_dTSAV = 'Wt2 dTSAV'
- Wt2_sTSAS = 'Wt2 sTSAS'
- Wt2_sTSAV = 'Wt2 sTSAV'
- Wt2_sjCLST = 'Wt2 sjCLST'
- Wt2_uTSAS = 'Wt2 uTSAS'
- Wt2_uTSAT = 'Wt2 dTSAT'
- Wt2_uTSAV = 'Wt2 uTSAV'
- Wt2_ujCLST = 'Wt2 ujCLST'
- Wt3_dTSAT = 'Min1 sTSAT'
- Wt3_sTSAT = 'Wt3 uTSAT'
- Wt3_sjCLST = 'Wt3 sjCLST'
- Wt3_ujCLST = 'Wt3 ujCLST'
- nvcl_kit.constants.has_SWIR(scalar: Scalar | str) bool
Does this scalar indicate short-wavelength infrared (SWIR) wavelengths ?
- Parameters:
scalar – a scalar in the form of either a string or a ‘Scalar’ object
- Returns:
True iff scalar indicates SWIR
- nvcl_kit.constants.has_TIR(scalar: Scalar | str) bool
Does this scalar indicate thermal infrared wavelengths (TIR) ?
- Parameters:
scalar – a scalar in the form of either a string or a ‘Scalar’ object
- Returns:
True iff scalar indicates TIR
- nvcl_kit.constants.has_VNIR(scalar: Scalar | str) bool
Does this scalar indicate visible and near-infrared (VNIR) wavelengths ?
- Parameters:
scalar – a scalar in the form of either a string or a ‘Scalar’ object
- Returns:
True iff scalar indicates VNIR
nvcl_kit.generators module
A collection of generator functions to make it easy to create scalar datasets, core images and plots
- nvcl_kit.generators.gen_core_images(reader, *, nvcl_id_list=None, startsampleno=0, endsampleno=10, max_magnify=False)
Returns core images given filter parameters
- Parameters:
nvcl_id_list – optional list of nvcl ids
startsampleno – optional start sample number, default is 0
endsampleno – optional end sample number, default is 10
max_magnify – optional, when True it will return close up images of core, default is False
- Returns:
yields a tuple of (nvcl id, dataset id, image log object, tray depth list, image html)
- nvcl_kit.generators.gen_downhole_scalar_plots(reader, *, nvcl_id_list=None)
Returns scalar downhole plots
- Parameters:
nvcl_id_list – optional list of nvcl ids
- Returns:
yields a tuple of (nvcl id, dataset id, scalar data object, PNG image byte array)
- nvcl_kit.generators.gen_scalar_by_depth(reader, *, nvcl_id_list=None, resolution=20.0, scalar_class=Scalar.ANY, log_type=None, top_n=5)
Returns scalar borehole data ordered by depth given filter parameters
- Parameters:
nvcl_id_list – optional list of nvcl ids
resolution – optional nvcl_kit.constants.Scalar class object, default Scalar.ANY
log_type – optional log type e.g. ‘1’ or ‘2’
top_n – optional, only retrieve the first n scalara at each depth, default value is 5
- Returns:
yields a tuple of (nvcl_id, logs object, scalar data object); logs object is retrieved from ‘get_logs_data()’
- nvcl_kit.generators.gen_tray_thumb_imgs(reader, *, nvcl_id_list=None)
Returns core tray images
- Parameters:
nvcl_id_list – optional list of nvcl ids
- Returns:
yields a tuple of (nvcl id, dataset id, image log object, tray depth list, JPEG image byte array)
nvcl_kit.param_builder module
This module contains functions used to build a set of NVCL service connection parameters
- nvcl_kit.param_builder.LOG_LVL = 20
Initialise debug level, set to ‘logging.INFO’ or ‘logging.DEBUG’
- nvcl_kit.param_builder.param_builder(provider: str, **options: dict) SimpleNamespace
Builds a set of parameters which can be passed to ‘NVCLReader’ for connecting to an NVCL service
- Parameters:
provider – state or territory name, one of: ‘nsw’, ‘tas’, ‘vic’, ‘qld’, ‘nt’, ‘sa’, ‘wa’, ‘csiro’
options – optional keyword parameters bbox: 2D bounding box in EPSG:4326, only boreholes within box are retrieved, default {“west”: -180.0,”south”: -90.0,”east”: 180.0,”north”: 0.0}) polygon: 2D ‘shapely.Polygon’ y/x axis order, EPSG:4326, limit to boreholes within this polygon depths: Tuple of range of depths (min,max) [metres] wfs_url: URL of WFS service, GeoSciML V4.1 BoreholeView nvcl_url: URL of NVCL service max_boreholes: Maximum number of boreholes to retrieve. If < 1 then all boreholes are loaded, default 0 use_cql: use “CQL_FILTER” in WFS GetFeature requests. Geoserver only. cache_path: the folder path for cache files
- Returns:
a SimpleNamespace object containing required connection parameters
nvcl_kit.reader module
This module is the main interface used to NVCL borehole data from the NVCL services..
- nvcl_kit.reader.ENFORCE_IS_PUBLIC = True
Enforce the ‘is_public’ flag , i.e. any data with ‘is_public’ set to ‘false’ will be ignored
- nvcl_kit.reader.LOG_LVL = 20
Initialise debug level, set to ‘logging.INFO’ or ‘logging.DEBUG’
- nvcl_kit.reader.MAX_DEPTH = 10000.0
Default maximum depth to search for boreholes
- nvcl_kit.reader.MIN_DEPTH = 0.0
Default minimum depth to search for boreholes
- class nvcl_kit.reader.NVCLReader(param_obj, wfs=None, log_lvl=None, skip_bhlist=False)
Bases:
objectA class to extract NVCL borehole data (see README.md for details)
- Parameters:
param_obj –
SimpleNamespace() object with parameters. It is recommended to utilise the ‘param_builder’ function to create it.
e.g. param_obj = param_builder('sa')
But if you want to create your own then here are the details:
param_obj fields are:
NVCL_URL - URL of NVCL service
WFS_URL - URL of WFS service, GeoSciML V4.1 BoreholeView
PROV - provider e.g. ‘nt’ ‘wa’ etc.
DEPTHS - (optional) Tuple of range of depths (min,max) [metres]
POLYGON - (optional) 2D ‘shapely.Polygon’ y/x axis order EPSG:4326, limit to boreholes inside this polygon
BBOX - (optional) 2D bounding box in EPSG:4326, only boreholes within box are retrieved
MAX_BOREHOLES - (optional) Maximum number of boreholes to retrieve. If < 1 then all boreholes are loaded
e.g. from types import SimpleNamespace from shapely import Polygon param_obj = SimpleNamespace() param_obj.BBOX = { "west": 132.76, "south": -28.44, "east": 134.39, "north": -26.87 } # Or use a POLYGON instead of a BBOX - Note the y/x axis ordering param_obj.POLYGON = Polygon( ((-28.44, 132.76), (-26.87, 132.76), (-26.87, 134.39), (-28.44, 134.39), (-28.44, 132.76)) ) param_obj.DEPTHS = (100.0, 900.0) param_obj.WFS_URL = "http://blah.blah.blah/geoserver/wfs" param_obj.NVCL_URL = "https://blah.blah.blah/nvcl/NVCLDataServices" param_obj.MAX_BOREHOLES = 20 param_obj.PROV = 'blah'
wfs – DEPRECATED owslib ‘WebFeatureService’ object
log_lvl – optional logging level (see ‘logging’ package), default is logging.INFO
skip_bhlist – optional fast init NVCLReader without loading the bhlist
- **NOTE: Check if ‘wfs’ is not ‘None’ to see if any boreholes were found
Check if ‘wfs_error’ is ‘True’ when there is a provider error**
- filter_feat_list(nvcl_ids_only=False, **kwargs)
- Returns a list of borehole features given a filter parameter
Filter parameters can be one of those returned by ‘get_feature_list’ e.g.
new_list = filter_feat_list(name=’ML006’)
- Parameters:
kwargs – keyword arguments key is name searched for, val is a list of possible values or a single value
nvcl_ids_only – if True will return a list of nvcl_id
- Returns:
a list of borehole features or empty list if unsuccessful
- get_algorithms()
Gets a dict of algorithm output ids and their versions
- Returns:
a dict of { ‘algorithmOutputId1’: ‘version1’, ‘algorithmOutputId2’: ‘version2’, … }
- get_all_imglogs(dataset_id)
Retrieves a list of all log objects from mosaic service
- Parameters:
dataset_id – dataset id, taken from ‘get_datasetid_list()’ or ‘get_dataset_list()’
- Returns:
a list of SimpleNamespace() objects, attributes are: log_id, log_name, sample_count. On error returns empty list
- get_borehole_data(log_id, height_resol, class_name, top_n=1)
Retrieves borehole mineral data for a borehole, will only return mineral class data
- Parameters:
log_id – borehole log identifier, string e.g. ‘ce2df1aa-d3e7-4c37-97d5-5115fc3c33d’ This is the first id from the list of triplets [log id, log type, log name] fetched from API calls such as ‘get_logs_data()’
height_resol – height resolution, float
class_name – name of scalar class, returned in output for informational purposes
top_n – optional number
- Returns:
dict: key - depth, float; value - if top_n=1 then SimpleNamespace( ‘colour’= RGBA float tuple, ‘className’= class name, ‘classText’= mineral name ) & if top_n>1 then [ SimpleNamespace(..) .. ]
- get_boreholes_list()
Returns a list of SimpleNamespace objects, extracted from WFS requests of boreholes. Fields are mostly taken from GeoSciML v4.1 Borehole View:
‘nvcl_id’, ‘identifier’, ‘name’, ‘description’, ‘purpose’, ‘status’, ‘drillingMethod’, ‘operator’, ‘driller’, ‘drillStartDate’, ‘drillEndDate’, ‘startPoint’, ‘inclinationType’, ‘href’, ‘boreholeMaterialCustodian’, ‘boreholeLength_m’, ‘elevation_m’, ‘elevation_srs’, ‘positionalAccuracy’, ‘source’, ‘x’, ‘y, ‘z’, ‘parentBorehole_uri’, ‘metadata_uri’, ‘genericSymbolizer’
- NB:
Depending on the WFS, not all fields will have values
‘href’ corresponds to ‘gsmlp:identifier’
‘x’, ‘y’, ‘z’ are x-coordinate, y-coordinate and elevation
‘nvcl_id’ is the GML ‘id’, used as an id in the NVCL services
Use ‘vars()’ function to convert SimpleNamespace to a dict
- Returns:
a list of SimpleNamespace whose fields correspond to a response from a WFS request of GeoSciML v4.1 BoreholeView
- get_dataset_list(nvcl_id)
Retrieves a list of dataset objects
- Parameters:
nvcl_id – NVCL ‘holeidentifier’ parameter, the ‘nvcl_id’ from each item retrieved from ‘get_feature_list()’ or ‘get_nvcl_id_list()’
- Returns:
a list of SimpleNamespace objects, attributes are: dataset_id, dataset_name, borehole_uri, tray_id, section_id, domain_id, created_date, (optional datetime object), modified_date (optional datetime object)
- get_datasetid_list(nvcl_id)
Retrieves a list of dataset ids
- Parameters:
nvcl_id – NVCL ‘holeidentifier’ parameter, the ‘nvcl_id’ from each item retrieved from ‘get_feature_list()’ or ‘get_nvcl_id_list()’
- Returns:
a list of dataset ids
- get_feature_list()
Returns a list of SimpleNamespace objects, extracted from WFS requests of boreholes. Fields are mostly taken from GeoSciML v4.1 Borehole View:
‘nvcl_id’, ‘identifier’, ‘name’, ‘description’, ‘purpose’, ‘status’, ‘drillingMethod’, ‘operator’, ‘driller’, ‘drillStartDate’, ‘drillEndDate’, ‘startPoint’, ‘inclinationType’, ‘href’, ‘boreholeMaterialCustodian’, ‘boreholeLength_m’, ‘elevation_m’, ‘elevation_srs’, ‘positionalAccuracy’, ‘source’, ‘x’, ‘y, ‘z’, ‘parentBorehole_uri’, ‘metadata_uri’, ‘genericSymbolizer’
- NB:
Depending on the WFS, not all fields will have values
‘href’ corresponds to ‘gsmlp:identifier’
‘x’, ‘y’, ‘z’ are x-coordinate, y-coordinate and elevation
‘nvcl_id’ is the GML ‘id’, used as an id in the NVCL services
- Returns:
a list of SimpleNamespace objects whose fields correspond to a response from a WFS request of GeoSciML v4.1 BoreholeView
- get_imagelog_data(nvcl_id)
Retrieves a set of image log data for a particular borehole
- Parameters:
nvcl_id – NVCL ‘holeidentifier’ parameter, the ‘nvcl_id’ from each item retrieved from ‘get_feature_list()’ or ‘get_nvcl_id_list()’
- Returns:
a list of SimpleNamespace() objects with attributes: log_id, log_name, sample_count, modified_date (optional)
- get_imagery_imglogs(dataset_id)
Retrieves ‘Imagery’ log objects from mosaic service
- Parameters:
dataset_id – dataset id, taken from ‘get_datasetid_list()’ or ‘get_dataset_list()’
- Returns:
a list of SimpleNamespace objects. Fields are: ‘log_id’, ‘log_name’, ‘sample_count’. On error returns an empty list.
- get_logs_data(nvcl_id)
Retrieves a set of generic log data for a particular borehole, given an nvcl id
- Parameters:
nvcl_id – NVCL ‘holeidentifier’ parameter, the ‘nvcl_id’ from each item retrieved from ‘get_feature_list()’ or ‘get_nvcl_id_list()’
- Returns:
a list of SimpleNamespace() objects with attributes: log_id, log_name, is_public, log_type, algorithm_id, mask_log_id,
created_date, modified_date (optional datetime objects not supported by all services)
NB: ‘mask_log_id’ is not supported by all services and may be an empty string
- get_mosaic_image(log_id, **options)
Retrieves images of NVCL core trays
- Parameters:
log_id – obtained through calling ‘get_mosaic_imglogs()’ or ‘get_tray_thumb_imglogs()’ or ‘get_tray_image_imglogs()’ or ‘get_imagery_imglogs()’
options – optional parameters: width: number of column the images are to be displayed, default value=3 (set width to 1 for full size images) startsampleno: the first sample image to be displayed, default value=0 endsampleno: the last sample image to be displayed, default value=99999
- Returns:
NVCL core tray images
- get_mosaic_imglogs(dataset_id)
Retrieves a list of ‘Mosaic’ log objects from mosaic service
- Parameters:
dataset_id – dataset id, taken from ‘get_datasetid_list()’ or ‘get_dataset_list()’
- Returns:
a list of SimpleNamespace objects. Fields are: ‘log_id’, ‘log_name’, ‘sample_count’. On error returns an empty list.
- get_nvcl_id_list()
Returns a list of NVCL ids, can be used as input to other ‘nvcl_kit’ API calls e.g. get_spectrallog_data()
- Returns:
a list of NVCL id strings
- get_profilometer_data(nvcl_id)
Retrieves a set of profilometer logs for a particular borehole
- Parameters:
nvcl_id – NVCL ‘holeidentifier’ parameter, the ‘nvcl_id’ from each item retrieved from ‘get_feature_list()’ or ‘get_nvcl_id_list()’
- Returns:
a list of SimpleNamespace() objects with attributes: log_id, log_name, sample_count, floats_per_sample, min_val, max_val
- get_profilometer_datasets(proflog_id, **options)
Gets profilometer datasets in JSON format
- Parameters:
proflog_id – profilometer log id, retrieved using ‘get_profilometer_data’ API
start_sample_no – retrieve sample numbers starting from this string e.g. ‘0’
end_sample_no – retrieve sample numbers ending with this string e.g. ‘2’
- Returns:
raw profilometer data as a list of ‘SimpleNamespace’ objects; keys are: “sampleNo” & “floatprofdata” returns an empty list upon error
- get_sampled_scalar_data(log_id, **options)
Returns data in downsampled format, to a certain height resolution
- Parameters:
log_id – obtained through calling ‘get_scalar_logs()’
outputformat – (optional) string ‘csv’ or ‘json’
startdepth – (optional) start of depth range, in metres from borehole collar
enddepth – (optional) end of depth range, in metres from borehole collar
interval – (optional) resolution to bin or average over
- get_scalar_data(log_id_list)
Downloads scalar data in CSV format
- Parameters:
log_id_list – a list of log ids obtained through calling ‘get_scalar_logs()’
- Returns:
scalar data in CSV format
- get_scalar_logs(dataset_id)
Retrieves a list of log objects for scalar plot service
- Parameters:
dataset_id – dataset_id, taken from ‘get_datasetid_list()’ or ‘get_dataset_list()’
- Returns:
a list of SimpleNamespace() objects, attributes are: log_id, log_name, is_public, log_type, algorithm_id, mask_log_id. ‘mask_log_id’ is not supported by all services and may be an empty string. On error returns empty list
- get_spectrallog_data(nvcl_id)
Retrieves a set of spectral log data for a particular borehole
- Parameters:
nvcl_id – NVCL ‘holeidentifier’ parameter, the ‘nvcl_id’ from each item retrieved from ‘get_feature_list()’ or ‘get_nvcl_id_list()’
- Returns:
a list of SimpleNamespace() objects with attributes: log_id, log_name, wavelength_units, sample_count, script, wavelengths
- get_spectrallog_datasets(log_id, **options)
Retrieves spectral log datasets as a binary string
- Parameters:
log_id – obtained through calling ‘get_spectrallog_data()’
start_sample_no – retrieve sample numbers starting from this string e.g. ‘0’
end_sample_no – retrieve sample numbers ending with this string e.g. ‘2’
- Returns:
a binary text string
- get_tray_depths(log_id)
Gets tray depths
- Parameters:
log_id – obtained through calling ‘get_tray_thumb_imglogs()’ or ‘get_tray_imglogs()’
- Returns:
a list of SimpleNamespace objects, with attributes: ‘sample_no’, ‘start_value’ and ‘end_value’
- get_tray_imglogs(dataset_id)
Retrieves ‘Tray Image’ log objects from mosaic service
- Parameters:
dataset_id – dataset id, taken from ‘get_datasetid_list()’ or ‘get_dataset_list()’
- Returns:
a list of SimpleNamespace objects. Fields are: ‘log_id’, ‘log_name’, ‘sample_count’. On error returns an empty list.
- get_tray_thumb_html(dataset_id, log_id, **options)
Gets core tray thumbnail images as HTML
- Parameters:
dataset_id – obtained through calling ‘get_datasetid_list()’
log_id – obtained through calling ‘get_tray_thumb_imglogs()’
width – specify the number of column the images are to be displayed, default value=3
startsampleno – the first sample image to be displayed, default value=0
endsampleno – the last sample image to be displayed, default value=99999
- Returns:
thumbnail image in HTML format
- get_tray_thumb_imglogs(dataset_id)
Retrieves a list of ‘Tray Thumbnail Images’ log objects from mosaic service
- Parameters:
dataset_id – dataset id, taken from ‘get_datasetid_list()’ or ‘get_dataset_list()’
- Returns:
a list of SimpleNamespace objects. Fields are: ‘log_id’, ‘log_name’, ‘sample_count’. On error returns an empty list.
- get_tray_thumb_jpg(log_id, sample_no='0')
Gets core tray thumbnail images as JPEG
- Parameters:
log_id – obtained through calling ‘get_tray_thumb_imglogs()’
sample_no – sample number, string e.g. ‘0’,’1’,’2’… optional, default is ‘0’
- Returns:
thumbnail image in JPEG format
- plot_scalar_png(log_id, **options)
Draws a plot as an image in PNG format.
- Parameters:
log_id – obtained through calling ‘get_scalar_logs()’
startdepth – (optional) the start depth of a borehole collar, default value=0
enddepth – (optional) the end depth of a borehole collar, default value=99999
samplinginterval – (optional) the interval of the sampling, default value=1
width – (optional) the width of the image in pixel, default value=300
height – (optional) the height of the image in pixel, default value=600
graphtype – (optional) an integer range from 1 to 3, 1=Stacked Bar Chart, 2=Scattered Chart, 3=Line Chart, default value=1
legend – (optional) value=1 or 0, 1 - indicates to show the legend, 0 to hide it, optional, default to 1
- Returns:
a 2d plot as a PNG image
- plot_scalars_html(log_id_list, **options)
Draws multiple plots, returned in HTML format
- Parameters:
log_id_list – a list of up to 6 log ids, obtained through calling ‘get_scalar_logs()’
startdepth – (optional) the start depth of a borehole collar, default value=0
enddepth – (optional) the end depth of a borehole collar, default value=99999
samplinginterval – (optional) the interval of the sampling, default value=1
width – (optional) the width of the image in pixel, default value=300
height – (optional) the height of the image in pixel, default value=600
graphtype – (optional) an integer range from 1 to 3, 1=Stacked Bar Chart, 2=Scattered Chart, 3=Line Chart, default value=1
legend – (optional) value=yes or no, if yes - indicate to show the legend, default to yes
- Returns:
one or more 2d plots as HTML
- nvcl_kit.reader.TIMEOUT = 2
Timeout for querying WFS and NVCL services (seconds)
- nvcl_kit.reader.bgr2rgba(bgr)
Converts BGR colour integer into an RGB tuple
- Parameters:
bgr – BGR colour integer
- Returns:
RGBA float tuple
nvcl_kit.svc_interface module
This forms the interface between the ‘reader’ class and the low-level web APIs.
- nvcl_kit.svc_interface.LOG_LVL = 20
Initialise debug level, set to ‘logging.INFO’ or ‘logging.DEBUG’