geosoft.gxpy.dap_client submodule¶
Geosoft dap server handling.
- Classes
Geosoft dap client
data type
return format for extracting a grid
progress
data extraction
bounding box
data information
search filter
result filter
search parameters
Regression tests provide usage examples: Tests
New in version 9.4.
-
class
BoundingBox
(minx=- 180, miny=- 90, minz=0, maxx=180, maxy=90, maxz=0, coordinate_system='WGS 84')[source]¶ Bases:
object
Bounding box instance.
- Parameters
minx –
MinX
miny –
MinY
minz –
MinZ
maxx –
MaxX
maxy –
MaxY
maxz –
MaxZ
coordinate_system –
CoordinateSystem
any supported coordinate system representation. Default is “WGS 84”.cs_as_xml – True to force the coordinate_system to be xml.
-
class
DapClient
(url='http://dap.geosoft.com/', get_catalog=False)[source]¶ Bases:
collections.abc.Sequence
DapClient class to communicate with a Geosoft DAP server.
- Parameters
url – url of the server, default is ‘http://dap.geosoft.com/’
get_catalog –
True
to get the server catalog. IfFalse
(the default) call methodcatalog()
to get the retrieve the catalog from the server. The catalog is cached as part of the instance.
New in version 9.4.
-
__init__
(url='http://dap.geosoft.com/', get_catalog=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
catalog
(search_parameters=None, refresh=False)[source]¶ Return a filtered catalog list.
- Parameters
search_parameters – search filter, instance of
SearchParameters
refresh –
True
to force a refresh, otherwise cached catalog is returned
- Returns
list of server catalog entries as
DataCard
instances
New in version 9.4.
-
property
configuration
¶ Return service configuration info.
See http://dap.geosoft.com/REST/service/help/operations/GetConfiguration
New in version 9.4.
-
datacard_from_id
(id)[source]¶ Return the
DataCard
instance based on the dataset ID #- Parameters
id – dataset id
- Returns
DataCard
instance
New in version 9.4.
-
fetch_data
(datacard, filename=None, extent=None, resolution=None, max_seconds=3600, progress=None, cadence=5)[source]¶ Fetch data from the server.
- Parameters
datacard –
DataCard
instance, or a dataset description (hierarchy, title) or just title.filename – file name in which to plase data, default is a temporary geosoft gris file.
extent –
geosoft.gxpy.geometry.Point2
instance, or aBoundingBox
instanceresolution – data resolution in the length units of the extent coordinate system
max_seconds – maximum number of seconds to wait for the process to finish
progress – callback that can report progress, for example
progress=print
will print to the consolecadence – time in seconds between checking on server preparation status.
- Returns
data file name, which may be a temporry file. Temporary files will only persist during the live of the current context.
import geosoft.gxpy.gx as gx import geosoft.gxpy.dap_client as gxdap: gx.GXpy() with gxdap.DapClient() as dap: # some point data dataset = dap['Kimberlite Indicator Mineral Grain Chemistry'] extent = gxgeo.Point2(((-112, 65), (-111, 65.5)), coordinate_system='NAD83') data_file = dap.fetch_data(dataset, extent=extent, resolution=0, progress=print)
New in version 9.4.
-
get
(what)[source]¶ GET information from the server.
- Parameters
what – string of what to get. for example “dataset/properties/265” retrieves the dataset properties for dataset 265. See http://dap.geosoft.com/REST/dataset/help for a list of the kinds of things you can get about a dataset.
- Returns
requested info as a dict.
-
post
(what)[source]¶ POST information from the server.
- Parameters
what – string of what to post.
- Returns
returned info as a dict.
-
property
url
¶ Server url.
-
exception
DapClientException
(message)[source]¶ Bases:
geosoft.GXRuntimeError
Exceptions from
geosoft.gxpy.dap
.
-
class
DataCard
(dap=None, id=None, title=None, type=0, hierarchy=None, stylesheet=None, extents=None, has_original=False)[source]¶ Bases:
geosoft.gxpy.geometry.Geometry
Single dataset information instance.
- Parameters
dap –
DapClient
instanceid –
Id
unique dataset identifier propertytitle –
Title
propertytype –
Type
dataset type, one ofDataType
values.hierarchy –
Hierarchy
location in the catalog hierarchystylesheet –
Stylesheet
metadata style sheetextents –
Extents
is aBoundingBox
instancehas_original –
HasOriginal
True if the original data is available
New in version 9.4.
-
__init__
(dap=None, id=None, title=None, type=0, hierarchy=None, stylesheet=None, extents=None, has_original=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
property
dap_client
¶ DapClient
instance for this dataset, may be None if card is not yet associated with a server.New in version 9.4.
-
property
disclaimer
¶ Disclaimer: http://dap.geosoft.com/REST/dataset/help/operations/GetDisclaimer
New in version 9.4.
-
property
document_properties
¶ Properties of the dataset as a document.
http://dap.geosoft.com/REST/dataset/help/operations/GetDocumentProperties
New in version 9.4.
-
property
edition
¶ Edition: http://dap.geosoft.com/REST/dataset/help/operations/GetEdition
New in version 9.4.
-
property
extent
¶ Object extent as a
Point2
instance.
-
property
grid_properties
¶ Grid data properties,
None
if not a grid dataset.http://dap.geosoft.com/REST/dataset/help/operations/GetGridProperties
New in version 9.4.
-
property
info
¶ Dataset info: http://dap.geosoft.com/REST/dataset/help/operations/GetDatasetById
New in version 9.4.
-
property
map_properties
¶ Map properties,
None
if not a map.http://dap.geosoft.com/REST/dataset/help/operations/GetMapProperties
New in version 9.4.
-
property
metadata
¶ Metadata: http://dap.geosoft.com/REST/dataset/help/operations/GetMetadata
New in version 9.4.
-
property
permission
¶ Permission: http://dap.geosoft.com/REST/dataset/help/operations/GetPermission
New in version 9.4.
-
property
point_properties
¶ Point properties,
None
if not a point (hxyz) dataset.http://dap.geosoft.com/REST/dataset/help/operations/GetHXYZProperties
New in version 9.4.
-
property
spatial_properties
¶ Spatial properties: http://dap.geosoft.com/REST/dataset/help/operations/GetProperties
New in version 9.4.
-
property
voxel_properties
¶ Voxel properties,
None
if not a voxel.http://dap.geosoft.com/REST/dataset/help/operations/GetVoxelProperties
New in version 9.4.
-
class
DataExtract
(filename, extents=None, resolution=0, format=0)[source]¶ Bases:
object
Data extraction instance.
- Parameters
filename – name of the data file
extents – data extent as a
BoundingBox
orgeosoft.gxpy.geopmetry.Point2
instanceresolution – desired resolution in the distance units of the extents coordinate system
format – one of the extraction formats for the data type, default is the first format.
New in version 9.4.
-
class
DataType
(value)[source]¶ Bases:
enum.Enum
Supported data types
-
ArcGIS
= 9¶
-
Database
= 4¶
-
Document
= 5¶
-
Drillhole
= 14¶
-
GMSYS2D
= 22¶
-
GMSYS3D
= 18¶
-
Generic
= 7¶
-
GeosoftOffline
= 24¶
-
Geostring
= 17¶
-
Geosurface
= 21¶
-
Grid
= 1¶
-
GridSection
= 12¶
-
ImageServer
= 10¶
-
Map
= 0¶
-
NoData
= 15¶
-
PDF
= 20¶
-
Picture
= 2¶
-
PictureSection
= 11¶
-
Point
= 3¶
-
ProjectZip
= 13¶
-
SPF
= 6¶
-
ThreeDV
= 16¶
-
VOXI
= 19¶
-
VectorVoxel
= 23¶
-
Voxel
= 8¶
-
-
class
ExtractProgressStatus
(value)[source]¶ Bases:
enum.Enum
An enumeration.
-
Cancelled
= 4¶
-
Complete
= 3¶
-
Compress
= 2¶
-
Extract
= 1¶
-
Failed
= 5¶
-
Prepare
= 0¶
-
-
class
GridExtractFormat
(value)[source]¶ Bases:
enum.Enum
An enumeration.
-
BIL
= 3¶
-
ERMapper
= 13¶
-
ESRIBinaryRaster
= 2¶
-
GXFCompressed
= 6¶
-
GXFText
= 5¶
-
Geopak
= 4¶
-
GeosoftCompressed
= 0¶
-
GeosoftUncompressed
= 1¶
-
ODDFPC
= 7¶
-
ODDFUnix
= 8¶
-
SurferV6
= 9¶
-
SurferV7
= 10¶
-
USGSPC
= 11¶
-
USGSUnix
= 12¶
-
-
class
ResultFilter
(path=None, depth=2147483647, start_index=0, max_results=0, valid_path=False)[source]¶ Bases:
object
Results filter instance.
- Parameters
path – to this location in the hierarchy
depth – to this depth in the hierarchy, default no depth limit
start_index – start index in the list
max_results – maximum results to include
New in version 9.4.
-
class
SearchFilter
(free_text_query=None, structured_metadata_query=None, extents=None, entirely_within=False, version=1)[source]¶ Bases:
object
Search filter instance.
- Parameters
free_text_query – title/keyword search filter
structured_metadata_query –
extents –
BoundingBox
instanceentirely_within –
True
for completely enclosed data,False
for intersecting data.version – minimum version, default is 1.
New in version 9.4.
-
class
SearchParameters
(search_filter=None, result_filter=None)[source]¶ Bases:
object
Search parameter instance, defined by a
SearchFilter
and aResultFilter
- Parameters
search_filter –
SearchFilter
instanceresult_filter –
ResultFilter
instance
New in version 9.4.