API

High level processing functions

The calling protocol of these functions is described in the end of this document (see High level API) but about the detailed source code of is available in this section.

geophpy.processing.general

DataSet Object general processing routines.

copyright

Copyright 2014-2020 L. Darras, P. Marty, Q. Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

* peakfilt :
* threshold :
* medianfilt :
geophpy.processing.general.threshold(dataset, setmin=None, setmax=None, setmed=False, setnan=False, valfilt=False)[source]

Dataset thresholding

cf. threshold()

geophpy.processing.general.peakfilt(dataset, method='hampel', halfwidth=5, threshold=3, mode='relative', setnan=False, valfilt=False)[source]

Datset peak filtering

cf. peakfilt()

geophpy.processing.general.medianfilt(dataset, nx=3, ny=3, percent=0, gap=0, valfilt=False)[source]

2-D median filter

cf. medianfilt()

geophpy.processing.general.festoonfilt(dataset, method='Crosscorr', shift=0, corrmin=0.4, uniformshift=False, setmin=None, setmax=None, valfilt=False)[source]

Destaggering filter

cf. festoonfilt()

geophpy.processing.general.detrend(dataset, order=1, setmin=None, setmax=None, valfilt=False)[source]

Dataset detrending using a constant value, a linear or polynomial fit.

cf. detrend()

geophpy.processing.general.regtrend(dataset, nx=3, ny=3, method='relative', component='local', loctrendout=None, regtrendout=None, valfilt=False)[source]

cf. dataset.py

geophpy.processing.general.wallisfilt(dataset, nx=11, ny=11, targmean=125, targstdev=50, setgain=8, limitstdev=25, edgefactor=0.1, valfilt=False)[source]

cf. wallisfilt()

geophpy.processing.general.ploughfilt(dataset, apod=0, azimuth=0, cutoff=100, width=2, valfilt=False)[source]

cf. ploughfilt()

geophpy.processing.general.zeromeanprofile(dataset, setvar='median', setmin=None, setmax=None, valfilt=False)[source]

Zero-traverse filter

cf. zeromeanprofile()

geophpy.processing.general.destripecon(dataset, Nprof=0, setmin=None, setmax=None, method='additive', reference='mean', config='mono', valfilt=False)[source]

Destripe dataset using a constant value.

cf. destripecon()

geophpy.processing.general.destripecub(dataset, Nprof=0, setmin=None, setmax=None, Ndeg=3, valfilt=False)[source]

Destripe dataset using a polynomial fit.

cf. destripecub()

geophpy.processing.magnetism

DataSet Object general magnetism processing routines.

copyright

Copyright 2014-2019 Lionel Darras, Philippe Marty, Quentin Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.processing.magnetism.logtransform(dataset, multfactor=5, setnan=True, valfilt=False)[source]

Apply a logarihtmic transformation to the dataset.

cf. logtransform()

geophpy.processing.magnetism.polereduction(dataset, apod=0, inclination=65, declination=0, azimuth=0, magazimuth=None, incl_magn=None, decl_magn=None)[source]

Dataset Reduction to the magnetic Pole.

cf. polereduction()

geophpy.processing.magnetism.continuation(dataset, apod=0, distance=2, totalfieldconversionflag=False, separation=0.7)[source]

Dataset continuation (upward/downward).

cf. continuation()

geophpy.processing.magnetism.eulerdeconvolution(dataset, apod=0, structind=None, windows=None, xstep=None, ystep=None)[source]

Classic Euler deconvolution.

cf. eulerdeconvolution()

geophpy.processing.magnetism.analyticsignal(dataset, apod=0)[source]

Dataset Analytic Signal.

cf. analyticsignal()

geophpy.processing.magnetism.magconfigconversion(dataset, fromconfig, toconfig, apod=0, FromBottomSensorAlt=0.3, FromTopSensorAlt=1.0, ToBottomSensorAlt=0.3, ToTopSensorAlt=1.0, inclination=65, declination=0, azimuth=0, magazimuth=None)[source]

Conversion between the different sensors configurations.

cf. magconfigconversion()

geophpy.processing.magnetism.susceptibility(dataset, prosptech, apod=0, downsensoraltitude=0.3, upsensoraltitude=1.0, calculationdepth=0.0, stratumthickness=1.0, inclineangle=65, alphaangle=0)[source]

Dataset magnetic susceptibilty of the equivalent stratum.

cf. susceptibility()

geophpy.operation.general

DataSet Object general operations routines.

copyright

Copyright 2014-2019 Lionel Darras, Philippe Marty, Quentin Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.operation.general.apodisation2d(val, apodisation_factor)[source]

2D apodisation, to reduce side effects

Parameters :

Val

2-Dimension array

Apodisation_factor

apodisation factor in percent (0-25)

Returns :
  • apodisation pixels number in x direction

  • apodisation pixels number in y direction

  • enlarged array after apodisation

High level plotting functions

The calling protocol of these functions is described in the end of this document (see High level API) but about the detailed source code of is available in this section.

geophpy.plotting.histo

Histogram Plot Management.

copyright

Copyright 2014-2019 Lionel Darras, Philippe Marty, Quentin Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.plotting.histo.getlimits(self, valfilt=False)[source]

Get limits values of histogram.

geophpy.plotting.histo.plot(dataset, **kwargs)[source]

Plot the dataset histogram.

cf. histo_plot()

geophpy.plotting.correlation

Module regrouping dataset correlation plots functions.

copyright

Copyright 2014-2019 Lionel Darras, Philippe Marty, Quentin Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.plotting.correlation.plotmap(dataset, fig=None, filename=None, method='Crosscorr', dpi=None, transparent=False, showenvelope=False, cmapname='jet', cmapdisplay=True)[source]

Plot data profile-to-profile correlation map.

geophpy.plotting.correlation.plotsum(dataset, fig=None, filename=None, method='Crosscorr', dpi=None, transparent=False, showenvelope=True, showfit=True)[source]

Plot the dataset profile-to-profile correlation sum.

geophpy.plotting.destrip

Destriping Mean Cross-Track Plot Management module.

copyright

Copyright 2017-2019 Lionel Darras, Quentin Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.plotting.destriping.plot_mean_track(dataset, fig=None, filename=None, Nprof='all', setmin=None, setmax=None, method='additive', reference='mean', config='mono', Ndeg=None, plotflag='raw', dpi=None, transparent=False)[source]

Plotting the mean cross-track (mean of each profile).

cf. meantrack_plot()

geophpy.plotting.spectral

Module regrouping Fourier transform plotting functions.

copyright

Copyright 2018-2019 Lionel Darras, Quentin Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.plotting.spectral.getspectrum_plottype_list()[source]

Return the list of available spectrum plot types.

geophpy.plotting.spectral.plot_directional_filter(dataset, cmapname=None, creversed=False, fig=None, filename=None, dpi=None, cmapdisplay=True, axisdisplay=True, paramdisplay=False, cutoff=100, azimuth=0, width=2)[source]

Plot 2-D directional filter.

geophpy.plotting.spectral.plotmap(dataset, fig=None, plottype='magnitude', filename=None, dpi=None, transparent=False, logscale=False, cmapdisplay=True, axisdisplay=True, rects=None, lines=None)[source]

Plot Dataset 2-D Fourier Transform.

geophpy.plotting.plot

Module regrouping map plotting functions.

copyright

Copyright 2014-2020 L. Darras, P. Marty, Q. Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.plotting.plot.plot(dataset, plottype, cmapname, creversed=False, fig=None, filename=None, cmmin=None, cmmax=None, interpolation='bilinear', levels=None, cmapdisplay=True, axisdisplay=True, labeldisplay=False, pointsdisplay=False, dpi=None, transparent=False, logscale=False, rects=None, points=None, marker='+', markersize=None)[source]

Dataset display.

cf. :meth:`~geophpy.dataset.DataSet.plot

geophpy.plotting.plot.extents2rectangles(extentlist)[source]

Convert a list of rectangle extent coordinates to a list of bottom left corner width and height coordinates.

High level API

GeophPy.dataset

DataSet Object constructor and methods.

copyright

Copyright 2014-2020 L. Darras, P. Marty, Q. Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

geophpy.dataset.getlinesfrom_file(filename, fileformat=None, delimiter='\t', skipinitialspace=True, skiprowsnb=0, rowsnb=1)[source]

Reads lines in a file.

Parameters :

Fileformat

file format

Filename

file name with extension to read, “test.dat” for example.

Delimiter

delimiter between fields, tabulation by default.

Skipinitialspace

if True, considers severals delimiters as only one : ” ” as ‘ ‘.

Skiprowsnb

number of rows to skip to get lines.

Rowsnb

number of the rows to read, 1 by default.

Returns:

Colsnb

number of columns in all rows, 0 if rows have different number of columns

Rows

rows.

geophpy.dataset.fileformat_getlist()[source]

Get list of format files availables

Returns: list of file formats availables, [‘ascii’, …]

geophpy.dataset.plottype_getlist()[source]

Get list of plot type availables

Returns : list of plot type availables, [‘2D_SURFACE’, ‘2D_CONTOUR’, …]

geophpy.dataset.interpolation_getlist()[source]

Get list of interpolation methods availables

Returns : list of interpolation methods availables, [‘bilinear’, ‘bicubic’, …]

geophpy.dataset.colormap_getlist(sort=True)[source]

Get the list of available colormaps.

If sort is True, colormaps are sorted alphabetically ingoring the case.

geophpy.dataset.colormap_plot(cmname, creversed=False, fig=None, filename=None, dpi=None, transparent=False)[source]

Plots the colormap.

Parameters :

Cmname

Name of the colormap, ‘gray_r’ for example.

Creversed

True to add ‘_r’ at the cmname to reverse the color map

Fig

figure to plot, None by default to create a new figure.

Filename

Name of the color map file to save, None if no file to save.

Dpi

‘dot per inch’ definition of the picture file if filename != None

Transparent

True to manage the transparency.

Returns:

Fig

Figure Object

geophpy.dataset.pictureformat_getlist()[source]

Get list of pictures format availables

Returns: list of picture formats availables, [‘jpg’, ‘png’, …]

geophpy.dataset.rasterformat_getlist()[source]

Get list of raster format files availables

Returns : list of raster file formats availables, [‘jpg’, ‘png’, …]

geophpy.dataset.correlmap(dataset, method='Crosscor')[source]

Profile-to-profile correlation map.

Profile-to-profile correlation map:
  • each odd profile in the dataset is incrementally shifted and the correlation coefficient computed against neighbouring profiles for each shift value

  • profiles are considered to be vertical, and the shift performed along the profile (hence vertically)

  • the correlation map size is then “twice the image vertical size” (shift may vary from -ymax to +ymax) by “number of profiles” (correlation is computed for each column listed in input)

Parameters

method (str, {'Crosscor', 'Pearson', 'Spearman', 'Kendall'}) – Correlation method use.

Returns

  • cormap (2-D array_like) – Profile-to-profile correlation map.

  • pva1 (2-D array_like) – Correlation weight map.

geophpy.dataset.griddinginterpolation_getlist()[source]

To get the list of available gridding interpolation methods.

geophpy.dataset.festooncorrelation_getlist()[source]

To get the list of available festoon correlation methods.

geophpy.dataset.sensorconfig_getlist()[source]

Returns the list of available magnetic sensor configurations.

class geophpy.dataset.Info[source]

Class to store grid information.

x_min

Grid minimum x values.

Type

float

x_max

Grid maximum x values.

Type

float

y_min

Grid minimum y values.

Type

float

y_max

Grid maximum y values.

Type

float

z_min

Grid minimum z values.

Type

float

z_max

Grid maximum z values.

Type

float

x_gridding_delta

Grid stepsize in the x_direction.

Type

float

y_gridding_delta

Grid stepsize in the y_direction.

Type

float

gridding_interpolation

Interpolation method used for gridding.

Type

str

plottype

Grid plot type.

Type

str

cmapname

Grid plot colormap name.

Type

str

class geophpy.dataset.Data(fields=None, x=None, y=None, values=None, east=None, north=None, long=None, lat=None, track=None, z_image=None, easting_image=None, northing_image=None)[source]

Class to store data.

Parameters
  • fields (list of str) – Field names corresponding to the data values (‘x’, ‘y’, ‘vgrad’).

  • values (array-like) – Ungridded data values.

  • east (array-like) – Ungridded data east values.

  • north (array-like) – Ungridded data north values.

  • z_image (2-D array-like.) – Gridded data values.

  • easting_image (2-D array-like.) – Gridded data easting values.

  • northing_image (2-D array-like.) – Gridded data northing values.

fields

Field names corresponding to the data values (‘x’, ‘y’, ‘vgrad’).

Type

list of str

x

Ungridded data local x-coordinates.

Type

array-like

y

Ungridded data local y-coordinates.

Type

array-like

values

Ungridded data values.

Type

array-like

east

Ungridded data east values.

Type

array-like

north

Ungridded data north values.

Type

array-like

tracks

Ungridded data track number for each data value.

Type

array-like

z_image

Gridded data values.

Type

2-D array-like.

easting_image

Gridded data easting values.

Type

2-D array-like.

northing_image

Gridded data northing values.

Type

2-D array-like.

class geophpy.dataset.GeoRefSystem[source]
class geophpy.dataset.DataSet(info=<geophpy.datasetbase.Info object>, data=<geophpy.datasetbase.Data object>, georef=<geophpy.dataset.GeoRefSystem object>, name=None)[source]

Creates a DataSet Object to process and display data.

info = Info() data = Data() georef = GeoRefSystem()

analyticsignal(apod=0)[source]

Conversion from potential field to analytic signal.

Parameters

apod (float) – Apodization factor, to limit Gibbs phenomenon at jump discontinuities.

Notes

The amplitude of the analytical signal (or the amplitude of the total gradient) of a potential field T is defined as 1:

|A(x, y, z)| = \sqrt{ \left( \frac{\partial T}{\partial x} \right)^2
          + \left( \frac{\partial T}{\partial y} \right)^2
          + \left( \frac{\partial T}{\partial z} \right)^2 }

The directional derivative are computed in the spectral domain using 2:

\mathcal{F} \left[ \frac{\partial^2 T}{\partial x^2} \right] = (ik_x)^2 \mathcal{F} \left[ T \right],
\mathcal{F} \left[ \frac{\partial^2 T}{\partial y^2} \right] = (ik_y)^2 \mathcal{F} \left[ T \right],
\mathcal{F} \left[ \frac{\partial^2 T}{\partial z^2} \right] = |k|^2 \mathcal{F} \left[ T \right].

and transformed back in the spatial domain for the total gradient amplitude calculation.

References

1

Blakely R. J. 1996. Potential Theory in Gravity and Magnetic Applications. Chapter 12.1, p313-320. Cambridge University Press.

2

Roest Walter R. , Verhoef Jacob and Pilkington Mark 1992. Magnetic interpretation using the 3-D analytic signal. Geophysics, vol. 57, no. 1, p116-125.

continuation(apod=0, distance=2, continuationflag=True, totalfieldconversionflag=False, separation=0.7)[source]

Upward or downwad continuation of the magnetic field.

The continuation computes the data that would be measured at an upper (upward continuation) or lower survey altitude (downward continuation). The computation is done in the spectral (frequency) domain using Fast Fourier Transform.

Returns the continued DataSet() object.

Parameters
  • apod (float) – Apodization factor (in %), to limit Gibbs phenomenon at jump discontinuities.

  • distance (float) – Continuation distance. Positive for an upward continuation (above ground level, away from the source) and negative for a downward continuation (under ground level, toward the source).

  • totalfieldconversionflag (bool,) – If True, the data are considered as gradient data (Total-field gradient or Fluxgate) and will be converted to total-field data after the continuation using the provided separation.

  • separation (folat) – Sensor separation for the conversion to Total-field data.

Notes

Assuming that all the magnetic sources are located below the observation surface, the continuation at a new observation altitude z of a survey acquired at an original altitude z_0 is given in the spectral domain by 3:

\mathcal{F}_{\Delta z,k} = \mathcal{F}_{TF} \cdot e^{-\Delta z |k|}

where \mathcal{F}_{TF} is the Fourier Transform of the measured data at the original altitude of observation z_0; \mathcal{F}_{\Delta z,k} is the Fourier Transform of the anomaly at the new altitude of observation z = z_0 - \Delta z; \Delta z = z_0 - z is the altitude increase between the original and new altitude of observation and |k| = \sqrt{k_x^2 + k_y^2} is the radial wavenumber where k_x and k_y are the wavenumber in the x and y-direction respectively.

The given altitude increase (\Delta z) is an algebraic value:

  • If \Delta z>0, the new altitude of observation is above the original altitude: the operation is an upward continuation;

  • if \Delta z<0, the new altitude of observation is below the original altitude: the operation is a downward continuation.

The upward continuation attenuates anomalies with respect to the wavelength in way that accentuates anomalies caused by deep sources and attenuates at the anomalies caused by shallow sources. It is hence a smoothing operator.

The downward continuation accentuates the shallowest components. It reduces spread of anomalies and corrects anomalies coalescences. It is usefull to discriminates the number of body source at the origin of a one big anomaly. It is an unsmoothing operator that is instable as small changes in the data can cause large and unrealistic variations so it is to be used with caution. Low-pass filtering before the downward continuation can be a solution to increase the filter stability.

References

3

Blakely R. J. 1996. Potential Theory in Gravity and Magnetic Applications. Chapter 12.1, p313-320. Cambridge University Press.

copy()

To duplicate a DataSet Object.

Parameters:

Dataset

DataSet Object to duplicate

Returns:

Newdataset

duplicated DataSet Object

correlmap(method='Crosscor')[source]

Profile-to-profile correlation map.

Each even profile in the dataset is incrementally shifted and the correlation coefficient is computed against the (standardized) mean of the two neighbouring profiles for each shift value.

Profiles are considered to be vertical and the shift is performed along the profile direction (y-direction). For a dataset of size ny*nx , the correlation map size is then 2*ny*nx (shift may vary from -ymax to +ymax).

Parameters

method (str, {'Crosscor', 'Pearson', 'Spearman', 'Kendall'}) – Correlation method use.

Returns

  • cormap (2-D array_like) – Profile-to-profile correlation map.

  • pva1 (2-D array_like) – Correlation weight map.

destripecon(Nprof='all', setmin=None, setmax=None, method='additive', reference='mean', config='mono', valfilt=False)[source]

Destriping dataset using profiles’ statistical moments (Moment Matching method).

Moment Matching method: the statistical moments (mean and standard deviation) of each profile in the dataset are computed and matched to reference values.

Parameters
  • Nprof (int or str ('all')) – Number of neighboring profiles used to compute the the reference values. Set to 'all' by default) to compute the mean over the whole dataset. If set to 0, it is the zero-mean (or zero-median) traverse filter.

  • setmin (float or None) – While computing the mean, do not take into account data values lower than setmin. If None, all data are considered.

  • setmax (float or None) – While computing the mean, do not take into account data values greater than setmax. If None, all data are considered.

  • method (str {'additive','multiplicative'}) – Destriping methode. If set to 'additive' (default), destriping is done additively. If set to 'multiplicative', it is done multiplicatively.

  • reference (str {'mean' 'median'}) – References used for destriping. If set to 'mean' (default), destriping is done using mean and standard deviation. If set to 'median', destriping is done using median and interquartile range.

  • config (str {'mono','multi'}) – Sensors configuration. If set to 'mono' (default), destriping is done using only offset matching (mean or median). If set to 'multi', destriping is done using both offset and gain (mean and standard deviation or median and interquartile range).

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

destripecub(Nprof=0, setmin=None, setmax=None, Ndeg=3, valfilt=False)[source]

To destripe a DataSet Object by a cubic curvilinear regression (chi squared)

Parameters:

Dataset

DataSet Object to be destriped

Nprof

number of profiles over which to compute the polynomial reference ; if set to 0 (default), compute the mean over the whole data

Setmin

while fitting the polynomial curve, do not take into account data values lower than setmin

Setmax

while fitting the polynomail curve, do not take into account data values greater than setmax

Ndeg

polynomial degree of the curve to fit

Valfilt

If True, the dataset values are filtered instead of the dataset z_image.

festoonfilt(method='Crosscorr', shift=0, corrmin=0.4, uniformshift=False, setmin=None, setmax=None, valfilt=False)[source]

Filters festoon-like artefacts out of in the dataset.

Returns the destaggered DataSet() object and the shift used for each profile.

Parameters
  • method (str, {‘Crosscorr’, ‘Pearson’, ‘Spearman’ or ‘Kendall’} (from festooncorrelation_getlist())) – Correlation method to use to compute the correlation coefficient in the correlation map.

  • shift (scalar or array of float) – Shift value (in pixels) to apply to the dataset profile. If shit=0, the shift will be determined for each profile by correlation with neighbours. If shift is a vector each value in shift will be applied to its corresponding odd profile. In that case shift must have the same size as the number of odd profiles.

  • corrmin (scalar in the range [0-1]) – Minimum correlation coefficient value to allow shifting.

  • uniformshift (bool) – If True, the shift is uniform on the map. If False the shift depends on each profile.

  • setmin (float) – Data values lower than setmin are ignored.

  • setmax (float) – Data values higher than setmax are ignored.

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

Returns

shift – Shift values used to destagger the dataset (unmodified if provided as an input parameter).

Return type

array of float

See also

correlmap(), correlshift()

Notes

The festoon-like artefacts are filtered based on the correlation between neighboring profiles.

For each odd profile index in the dataset, the correlation with its neighboring profile is calculated using the provided correlation method. Then, the profile is shifted from a sample and the correlation is computed anew and so forth to build a correlation map fo revery possible shift. For each profile, the shift with the maximum correlation coefficient is chosen as the best shift and used to destagger the dataset. It the shift is set to be uniform on the map, the correlation map is summed up and the shit correspoding to the global maximum correlation coefficient is used for each odd profile.

Alternatively, if a custom set of shift is provided, it will be used to destagger the dataset. It must have the same size as the number of odd profile in the dataset.

Example

>>> dataset.festoonfilt(method='Crosscorr', shift=0, corrmin=0.6, uniformshift=False)
classmethod from_file(filenameslist, fileformat=None, delimiter=None, x_colnum=1, y_colnum=2, z_colnum=3, skipinitialspace=True, skip_rows=0, fields_row=1, verbose=False)

Build a DataSet Object from a file.

Parameters:

Filenameslist

list of files to open [‘file1.xyz’, ‘file2.xyz’ …] or [‘file*.xyz’] to open all files with filename beginning by “file” and ending by “.xyz”

Fileformat

format of files to open (None by default implies automatic determination from filename extension)

Note: all files must have the same format

Delimiter

pattern delimiting fields within one line (e.g. ‘ ‘, ‘,’, ‘;’ …)

X_colnum

column number of the X coordinate of the profile (1 by default)

Y_colnum

column number of the Y coordinate inside the profile (2 by default)

Z_colnum

column number of the measurement profile (3 by default)

Skipinitialspace

if True, several contiguous delimiters are equivalent to one

Skip_rows

number of rows to skip at the beginning of the file, i.e. total number of header rows (1 by default)

Fields_row

row number where to read the field names ; if -1 then default field names will be “X”, “Y” and “Z”

Returns:

Success

true if DataSet Object built, false if not

Dataset

DataSet Object build from file(s) (empty if any error)

Example:

success, dataset = DataSet.from_file(“file.csv”)

get_grid_values()

Return dataset Z_image.

get_gridcorners()

Return dataset grid corners coordinates.

Returns None if no interpolation was made. Use :meth:~geophpy.dataset.DataSet.get_boundingbox` to get the ungridded data values’ bounding box.

get_gridextent()

Return dataset grid extent.

get_median_xstep(prec=2)

Return the median step between two distinct x values rounded to the given precision.

get_median_xystep(x_prec=2, y_prec=2)

Return the median steps between two distinct x and y values rounded to the given precisions.

get_median_ystep(prec=2)

Return the median step between two distinct y values rounded to the given precision.

get_values()

Return the dataset values.

get_xgrid()

Return dataset x-coordinate matrix of the Z_image.

get_xvalues()

Return the x-coordinates from the dataset values.

get_xvect()

Return dataset x-coordinate vector of the Z_image.

get_xygrid()

Return dataset x- and y-coordinate matrices of the Z_image.

get_xyvalues()

Return the x- and y-coordinates from the dataset values.

get_xyvect()

Return dataset x- and y-coordinate vectors of the Z_image.

get_xyzvalues()

Return both the x, y-coordinates and dataset ungridded values.

get_ygrid()

Return dataset y-coordinate matrix of the Z_image.

get_yvalues()

Return the y-coordinates from the dataset values.

get_yvect()

Return dataset y-coordinate vector of the Z_image.

histo_getlimits(valfilt=False)

Return the data min and max values.

Parameters

valfilt (bool) – If True, min and max are taken from data values. Otherxise, min and max are taken from data z_image.

Returns

zmin, zmax – Data min and max values.

Return type

float

histo_plot(fig=None, filename=None, zmin=None, zmax=None, cmapname=None, creversed=False, cmapdisplay=False, coloredhisto=True, showtitle=True, dpi=None, transparent=False, valfilt=False)

Plot the dataset histogram.

Parameters
  • fig (Matplotlib figure object) – Figure to use for the plot, None (by default) to create a new figure.

  • filename (str or None) – Name of file to save the figure, None (by default).

  • zmax (zmin,) – Minimal and maximal values to represent.

  • cmapname (str) – Name of the color map to be used ‘gray’ for example. To use a reversed colormap, add ‘_r’ at the end of the colormap name (‘gray_r’) or set creversed to True.

  • creversed (bool) – Flag to add ‘_r’ at the end of the color map name to reverse it.

  • cmapdisplay (bool) – Flag to display a color bar (True by default).

  • coloredhisto (bool) – Flag to color the histogram using the given colormap (True by default). If False, black will be used.

  • showtitle (bool) – Flag to display the dataset name as title (True by default).

  • dpi (int or None) – Definition (‘dot per inch’) to use when saving the figure into a file (None by default).

  • transparent (bool) – Flag to manage transparency when saving the figure into a file (False by default).

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image() (False By default).

Returns

  • fig (Matplotlib Figure Object) – Dataset histogram figure.

  • cmap (Matplotlib ColorBar Object) – Colorbar associated with the figure if cmapdisplay is True, None otherwise.

interpolate(interpolation='none', x_step=None, y_step=None, x_prec=2, y_prec=2, x_frame_factor=0.0, y_frame_factor=0.0)

Dataset gridding.

Parameters
  • interpolation (str {'none', 'nearest', 'linear', 'cubic'}) –

    Method used to grid the dataset. Can be:

    none

    (by default) simply projects raw data on a regular grid without interpolation. Holes are filled with NaNs and values falling in the same grid cell are averaged.

    nearest

    return the value at the data point closest to the point of interpolation.

    linear

    tesselate the input point set to n-dimensional simplices, and interpolate linearly on each simplex.

    cubic

    return the value determined from a piecewise cubic, continuously differentiable (C1), and approximately curvature-minimizing polynomial surface.

  • y_step (x_step,) – Gridding step in the x and y direction. Use None (by default) to estimate the median x- and y-step from data values.

  • y_prec (x_prec,) – Decimal precision to keep for the grid computation. None (by default) to use the maximal number of decimal present in the data values coordinates.

  • x_frame_factor – Frame extension coefficient along x axis (e.g. 0.1 means xlength +10% on each side, i.e. xlength +20% in total) ; pixels within extended borders will be filled with “nan”

  • y_frame_factor – Frame extension coefficient along y axis (e.g. 0.45 means yheight +45% top and bottom, i.e. yheight +90% in total) ; pixels within extended borders will be filled with “nan”

Returns

Return type

Gridded DataSet object.

logtransform(multfactor=1, setnan=True, valfilt=False)[source]

Apply a logarihtmic transformation to the dataset.

The logarihtmic transformation is a contrast enhancement filter that enhances information at low-amplitude values while preserving the relative amplitude information.

Returns the transformed DataSet() object.

Parameters
  • multfactor (float) – Multiplying factor to apply to the data to increase/decrease the number of data that falls into the condition ]-1,1[.

  • setnan (bool,) – If True, the data value between ]-1,1[ will be replaced by nans. If False, they will be replaced by zero.

  • valfilt (bool,) – If True, then filters values instead of z_image

Notes

The logarihtmic transformation is defined as 4:

\mathcal{F}\{f\} =
   \left\{
   \begin{array}{ccc}
      -\log_{10} (-f) & for & f <-1 \\
       \log_{10} (f) & for & f >1 \\
           0         & for & -1< f >1 \\
   \end{array}
   \right.

where: f is the original data.

References

4

Morris B., Pozza M., Boyce J. and Leblanc G. 2001. Enhancement of magnetic data by logarithmic transformation. The Leading Edge, vol. 20, no. 8, p882-885.

magconfigconversion(fromconfig, toconfig, apod=0, FromBottomSensorAlt=0.3, FromTopSensorAlt=1.0, ToBottomSensorAlt=0.3, ToTopSensorAlt=1.0, inclination=65, declination=0, azimuth=0, magazimuth=None)[source]

Conversion between the different magnetic survey sensor’s configurations.

Returns the transformed DataSet() object.

Parameters
  • fromconfig (str {"TotalField"|"TotalFieldGradient"|"Fluxgate"}, from sensorconfig_getlist()) – Initial sensor’s configuration from which to convert de data.

  • toconfig (str {"TotalField"|"TotalFieldGradient"|"Fluxgate"}, from sensorconfig_getlist()) – Final sensor’s configuration to which to convert de data.

  • apod (float) – Apodization factor, to limit Gibbs phenomenon at jump discontinuities.

  • FromBottomSensorAlt (float) – Bottom sensor altidue of the initial sensor’s configuration.

  • FromTopSensorAlt (float) – Top sensor altidue of the initial sensor’s configuration.

  • ToBottomSensorAlt (float) – Bottom sensor altidue of the final sensor’s configuration.

  • ToTopSensorAlt (float) – Top sensor altidue of the final sensor’s configuration.

  • inclination (float) – Ambient magnetic field inclination (I) in degrees positive below horizontal.

  • declination (float) – Ambient magnetic field declination (D) in degrees positive east of geographic (true) north.

  • azimuth (float) – Azimuth of the survey x-axis in degrees positive east of north (\theta, the angle between the survey profile direction and the geographic north). The magnetic azimuth (\phi) is computed from the declination (D) and the azimuth as \phi= D - \theta.

  • magazimuth (float) – Magnetic azimuth survey x-axis in degrees positive east of north (\phi, the angle between the survey profile direction and the magnetic north). None by default. If a value is given, the declination is ignored and the magnetic azimuth will derectly be used.

Notes

as 5:

References

5

Tabbagh A., Desvignes G. and Dabas M. 1997. Processing of Z Gradiometer Magnetic data using Linear Transforms and Analytical Signal. Archaelogical Prospection, vol. 4, issue 1, p1-13.

meantrack_plot(fig=None, filename=None, Nprof=0, setmin=None, setmax=None, method='additive', reference='mean', config='mono', Ndeg=None, plotflag='raw', dpi=None, transparent=False)

Plot the dataset mean cross-track profile before and after destriping.

Parameters :

Fig

figure to plot, None by default to create a new figure. matplotlib.figure.Figure

Filename

Name of the histogram file to save, None if no file to save.

Nprof

number of profiles to compute the reference mean

Setmin

float, While computing the mean, do not take into account data values lower than setmin.

Setmax

float, While computing the mean, do not take into account data values greater than setmax.

Method

destriping method (additive or multiplicative)

Reference

destriping reference (mean and standard deviation or median and interquartile range)

Config

destriping configuration (‘mono’ sensor: only offset matching (mean / median), ‘multi’ sensor: both offset and gain (standard deviation/interquartile range))

Plotflag

str, {‘raw’, ‘destriped’, ‘both’} to plot raw, destriped or both data

Ndeg

polynomial degree of the curve to fit

Transparent

True to manage the transparency.

Returns :

Fig

Figure Object

Note

The mean cross-track profile is the profile composed the mean of each profile in the dataset.

medianfilt(nx=3, ny=3, percent=0, gap=0, valfilt=False)[source]

Apply a median filter (decision-theoretic or standard) to the dataset.

Returns the filtered DataSet() object.

Parameters
  • nx (int) – Size, in number of sample, of the filer in the x-direction.

  • ny (int) – Size, in number of sample, of the filter in the y-direction.

  • percent (float) – Threshold deviation (in percents) to the local median value (for absolute field measurements).

  • gap (float) – Threshold deviation (in raw units) to the median value (for relative anomaly measurements).

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

peakfilt(method='hampel', halfwidth=5, threshold=3, mode='relative', setnan=False, valfilt=False)[source]

Eliminate peaks from the dataset.

Returns the de-peaked DataSet() object.

Parameters
  • method (str {'median', 'hampel'}) – Type of the decision-theoric filter used to determine outliers.

  • halfwidth (scalar) – Filter half-width.

  • threshold (scalar (positive)) – Filter threshold parameter. If t=0 and method=’hampel’, it is equal to a standard median filter.

  • mode (str {'relative', 'absolute'}) – Median filter mode. If ‘relative’, the threshold is a percentage of the local median value. If ‘absolute’, the threshold is a value.

  • setnan (bool) – If True, the outliers are replaced by nan instead of the local median.

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

plot(plottype='2D-SCATTER', cmapname=None, creversed=False, fig=None, filename=None, cmmin=None, cmmax=None, interpolation='bilinear', levels=100, cmapdisplay=True, axisdisplay=True, labeldisplay=True, pointsdisplay=False, dpi=None, transparent=False, logscale=False, rects=None, points=None, marker='+', markersize=None)

2D representation of the dataset.

Parameters
  • plottype (str, {'2D-SCATTER', '2D-SURFACE', '2D-CONTOUR', '2D-CONTOURF', '2D-POSTMAP'}) –

    Plot type for the data representation. Plot type can be

    2D-SCATTER

    (by default) ungridded data values are dispay in a scatter plot. Plot type ‘SCATTER’, ‘SCAT’ and ‘SC’ are also recognised.

    2D-SURFACE

    Gridded data values are dispay in a surface (image) plot. Plot type ‘SURFACE’, ‘SURF’ and ‘SF’ are also recognised.

    2D-CONTOUR

    Gridded data values are dispay in a UNFILLED contour plot. If this plot type is used, you can specify the number of contours used with the levels keyword. Plot type ‘CONTOUR’, ‘CONT’ and ‘CT’ are also recognised.

    2D-CONTOURF

    Gridded data values are dispay in a FILLED contour plot. If this plot type is used, you can specify the number of contours used with the levels keyword. Plot type ‘CONTOURF’, ‘CONTF’ and ‘CF’ are also recognised.

    2D-POSTMAP

    Ungridded data position are dispay in a scatter plot. It is different from the ‘2D-SCATTER’ plot because the data value is not represented (all point have the same color). Plot type ‘POSTMAP’, ‘POST’ and ‘PM’ are also recognised.

  • cmapname (str) – Name of the color map to be used ‘gray’ for example. To use a reversed colormap, add ‘_r’ at the end of the colormap name (‘gray_r’) or set creversed to True.

  • creversed (bool) – Flag to add ‘_r’ at the end of the color map name to reverse it.

  • fig (Matplotlib figure object) – Figure to plot, None by default to create a new figure. If a figure object is provided, it wiil be cleared before displaying the current data.

  • filename (str or None) – Name of file to save the figure, None (by default).

  • cmmin (scalar) – Minimal value to display in the color map range.

  • cmmax (scalar) – Maximal value to display in the color map range.

  • interpolation (str,) – Interpolation method used for the pixel interpolation (‘bilinear’ by default). If interpolation is ‘none’, then no interpolation is performed for the display. Supported values are ‘none’, ‘nearest’, ‘bilinear’, ‘bicubic’, ‘spline16’, ‘spline36’, ‘hanning’, ‘hamming’, ‘hermite’, ‘kaiser’, ‘quadric’, ‘catrom’, ‘gaussian’, ‘bessel’, ‘mitchell’, ‘sinc’, ‘lanczos’.

  • levels ((int or array-like)) – Determines the number and positions of the contour lines / regions. If an int n, use n data intervals; i.e. draw n+1 contour lines. The level heights are automatically chosen. If array-like, draw contour lines at the specified levels. The values must be in increasing order.

  • cmapdisplay (bool) – True to display colorbar, False to hide the colorbar.

  • axisdisplay (bool) – True to display axis (and their labels), False to hide axis (and labels).

  • labeldisplay (bool) – True to display labels on axis, False to hide labels on axis.

  • pointsdisplay (bool) – True to display grid points.

  • dpi (int or None) – Definition (‘dot per inch’) to use when saving the figure into a file (None by default).

  • transparent (bool) – Flag to manage transparency when saving the figure into a file (False by default).

  • logscale (bool) – Flag to use a logarithmic color scale.

  • rects (None or array_like) – Coordinates of additional rectanngles to display: [[x0, y0, w0, h0], [x1, y1, w1, h1], …]. None by default.

  • points (None or array_like) – Coordinates of additional points to display: [[x0, y0], [x1, y1], …]. None by default.

  • marker (str) – Matplotlib marker style for data point display.

  • markersize (scalar) – Size for the marker for data point display.

Returns

  • fig (Matplotlib Figure Object) – Dataset map figure.

  • cmap (Matplotlib ColorBar Object) – Colorbar associated with the figure if cmapdisplay is True, None otherwise.

ploughfilt(apod=0, azimuth=0, cutoff=100, width=2, valfilt=False)[source]

Apply a directionnal (“anti-ploughing”) filter to the dataset.

Returns the filtered DataSet() object.

Parameters
  • apod (float) – Apodization factor in percent [0,1].

  • azimuth (scalar) – Filter azimuth in degree.

  • cutoff (scalar) – Cutoff spatial frequency (in number of sample).

  • width (int) – Filter width parameter.

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

Notes

The filter used is a combination of a classic gaussian low-pass filter of order 2 with a directional filter. This gaussian low-pass directional filter is defined as 6:

\mathcal{F}(\rho, \theta, f_c) = e^{-(\rho / f_c)^2} \cdot ( 1-e^{-r^2 / \tan(\theta - \theta_0)^n} )

where: \rho and \theta are the current point polar coordinates; f_c is the gaussian low-pass filter cutoff frequency; \theta_0 is the directional filter’s azimuth and n is the parameter that controls the filter width.

References

6

Tabbagh J. 2001. Filtre directionel permettant d’eliminer les anomalies crees par le labour, in “Filtering, Optimisation and Modelling of Geophysical Data in Archaeological Prospecting”, Fondazione Ing. Carlo Maurillo Lerici, Politecnico di Milano, M. Cucarzi and P. Conti (eds.), Roma 2001, 202p, p161-166.

Examples

>>> dataset.ploughfilt()
>>> dataset.ploughfilt(apod=0, azimuth=30, cutoff=100, width=2)
>>> dataset.ploughfilt(azimuth=45, cutoff=None)
polereduction(apod=0, inclination=65, declination=0, azimuth=0, magazimuth=None, incl_magn=None, decl_magn=None)[source]

Reduction to the pole.

The reduction to the pole is a phase transformation in the spectral domain applied to the total magnetic field to computes the “anomaly that would be measured at the north magnetic pole, where induced magnetization and ambient field both would be directed vertically down.” 7

Returns the transformed DataSet() object.

Parameters
  • apod (float) – Apodization factor, to limit Gibbs phenomenon at jump discontinuities.

  • inclination (float) – Ambient magnetic field inclination (I) in degrees positive below horizontal.

  • declination (float) – Ambient magnetic field declination (D) in degrees positive east of geographic (true) north.

  • azimuth (float) – Azimuth of the survey x-axis in degrees positive east of north (\theta, the angle between the survey profile direction and the geographic north). The magnetic azimuth (\phi) is computed from the declination (D) and the azimuth as \phi= D - \theta.

  • magazimuth (float) – Magnetic azimuth survey x-axis in degrees positive east of north (\phi, the angle between the survey profile direction and the magnetic north). None by default. If a value is given, the declination is ignored and the magnetic azimuth will derectly be used.

  • decl_magn (incl_magn,) – The source remanent magnetization inclination and declination in degrees. By default they are set to None, the remanent magnetization is neglected.

Notes

If the magnetization and ambient field are not vertical, a uniform magnetic source will produce a skewed anomaly. The reduction to the pole aims to eliminate this effect by transforming the “measured total field anomaly into the vertical component of the field caused by the same source distribution magnetized in the vertical direction”.

This transformation is given in the spectral domain by:

\mathcal{F}_{RTP} = \mathcal{F}_{TF} \cdot \mathcal{F}

where \mathcal{F}_{TF} is the Fourier Transform of measured total field anomaly and \mathcal{F} is defined as:

\mathcal{F}_{m,f}\{k_x, k_x\} = \frac{|k|^2}{
    a_1 k_x^2
    + a_2 k_y^2
    + a_3 k_x k_y
    + i |k| (b1 k_x + b2 k_y)}, |k| \ne 0

with

a_1 &= m_z f_z - m_x f_x, \\
a_2 &= m_z f_z - m_y f_y, \\
a_3 &= -m_y f_x - m_x f_y, \\
b_1 &= m_x f_z + m_z f_x, \\
b_2 &= m_y f_z + m_z f_y, \\

where m=(m_x, m_y, m_z) is the unit-vector in the direction of the magnetization of the source; f = (f_x, f_y, f_z) is the unit-vector in the direction of the ambiant field; |k| = \sqrt{k_x^2 + k_y^2} is the radial wavenumber and k_x and k_y are the wavenumber in the x and y-diection respectively.

References

7

Blakely R. J. 1996. Potential Theory in Gravity and Magnetic Applications. Chapter 12.3.1, p330. Cambridge University Press.

regrid(x_step=None, y_step=None, method='cubic')

Dataset re-gridding.

During regridding, a copy of the dataset is re-sampled (see sample()) and interpolated with the given x and y-steps.

Parameters
  • y_step (x_step,) – Gridding step in the x and y direction. Use None (by default) to resample current grid by a factor 2 (step_new = step_old*0.5).

  • method (str {'cubic', 'nearest', 'linear'}) – Method used to re-grid the dataset. see interpolate()

Returns

Return type

Re-gridded DataSet object.

Note

Only the grid is affected and the ungriddedd data values are kept unchanged. to propagate a change in the ungriddedd data values, you may want to use the filters valfilt keyword or the association of sample() and sample().

regtrend(nx=3, ny=3, method='relative', component='local', valfilt=False)[source]

To filter a DataSet Object from its regional trend

Parameters:

Dataset

DataSet Object to be filtered

Nx

filter size in x coordinate

Ny

filter size in y coordinate

Method

set to “relative” to filter by relative value (resistivity) or to “absolute” to filter by absolute value (magnetic field)

Component

set to “local” to keep the local variations or to “regional” to keep regional variations

Valfilt

if set to True, then filters data.values instead of data.zimage

sample()

Re-sample data at ungridded sample position from gridded Z_image.

Re-sample ungridded values from gridded Z_image using a cubic spline spline interpolation.

threshold(setmin=None, setmax=None, setmed=False, setnan=False, valfilt=False)[source]

Threshold a dataset in the given interval.

Returns the thresholded DataSet() object.

Parameters
  • setmin (float) – Minimal interval value. All values lower than setmin will be replaced by setmin (if both setmed and setnan are False).

  • setmax (float) – Maximal interval value. All values lower than setmax will be replaced by setmax (if both setmed and setnan are False).

  • setmed (bool) – If set to True, out of range values are replaced by the profile’s median.

  • setnan (bool) – If set to True, out of range values are replaced by NaNs

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

Note

If both setnan and setmed are True at the same time, setnan prevails.

to_file(filename, fileformat=None, delimiter='\t', description=None, gridtype='surfer7bin', verbose=False, ignore_nodata=True)

Save a DataSet Object to a file.

Parameters
  • filename (str) – Name of file to save.

  • fileformat ({"ascii", "netcdf", "surfer", "uxo", "cmd"}) – Format for the output file. If None (by default), the fileformat will automatically by determined from filename extension.

  • delimiter ({" ", ",", ";"}, optional) – Delimiter of the output file when fileformat is ‘ascii’. By default ” “.

  • gridtype ({'surfer7bin', 'surfer6bin', 'surfer6ascii'}, optional) – Format for the surfer grid file when fileformat is ‘surfer’. By default ‘surfer7bin’.

  • description (str) – Description of the output file when fileformat is ‘netcdf’. By default ‘None’.

  • ignore_nodata (bool, optional) – Flag to ignore when saving the file. Default is True.

Returns

success – True if the file was written successfully, False otherwise.

Return type

bool

wallisfilt(nx=11, ny=11, targmean=125, targstdev=50, setgain=8, limitstdev=25, edgefactor=0.1, valfilt=False)[source]

Apply the Wallis contrast enhancement filter to the dataset.

Returns the contrast-enhanced DataSet() object.

Parameters
  • nx (int) – filter window size in x-direction

  • ny (int) – filter window size in y-direction

  • targmean (float) – The target mean brigthness level (m_d)

  • targstdev (float) – The target standard deviation (\sigma_d)

  • setgain (float) – Amplification factor for contrast (A)

  • limitstdev (float) – Limitation on the window standard deviation to prevent too high gain value if data are dispersed

  • edgefactor (float in the range of [0,1]) – Brightness forcing factor (\alpha), controls ratio of edge to background intensities.

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

Notes

The Wallis filter is a locally adaptative contrast enhancement filter based on the local statistical properties of sub-windows in the image. It adjusts brightness values (grayscale image) in the local window so that the local mean and standard deviation match target values.

The Wallis operator is defined as 8:

\frac{A \sigma_d}{A \sigma_{(x, y)} + \sigma_d} [f_{(x, y)} - m_{(x, y)}] + \alpha m_d + (1 - \alpha)m_{(x, y)}

where: A is the amplification factor for contrast; \sigma_d is the target standard deviation; \sigma_{(x, y)} is the standard deviation in the current window; f_{(x, y)} is the center pixel of the current window; m_{(x, y)} is the mean of the current window; \alpha is the edge factor (controlling portion of the observed mean, and brightness locally to reduce or increase the total range) and m_d is the target mean.

As the Wallis filter is design for grayscale image, the data are internally converted to brightness level before applying the filter. The conversion is based on the minimum and maximum value in the dataset and uses 256 levels (from 0 to 255).

References

8

Scollar I., Tabbagh A., Hesse A. and Herzog I. 1990. Archaeological Prospecting and Remote Sensing (Topics in Remote Sensing 2). 647p, chapter 4.5 p174. Cambridge University Press.

Examples

>>> dataset.wallisfilt()
>>> dataset.wallisfilt(nx=21, ny=21, targmean=125, targstdev=50)
zeromeanprofile(setvar='median', setmin=None, setmax=None, valfilt=False)[source]

Subtract the mean (or median) of each profile in the dataset.

Returns the zero-mean (or zero-median) DataSet() object.

Parameters
  • setvar (str, {'mean', 'median'}) – Profile’s statistical property be subtracted from each profile.

  • setmin (float) – While computing the mean, do not take into account data values lower than setmin.

  • setmax (float) – While computing the mean, do not take into account data values greater than setmax.

  • valfilt (bool) – If set to True, the values() are filtered instead of the z_image().

Notes

For each profile in the dataset, the mean (or median depending on setvar) is calculated and subtracted from the profile.

This is equivalent to the destripecon() method in configuration mono sensor using the additive destriping method and a number of profile for the calculation equals to zero.

Examples

>>> dataset.zeromeanprofile(setvar='median')
    equivalent to
>>> dataset.destripecon(Nprof=0, method='additive', config='mono', reference='median')

geophpy.geoposset

Module for the management of Geographic Positioning Sets.

This module provides a number of tools, including the GeoPosSet class, to dealing with Geographic Positioning Sets (or Ground Control Points).

copyright

Copyright 2014-2019 Lionel Darras, Philippe Marty, Quentin Vitale and contributors, see AUTHORS.

license

GNU GPL v3.

Conversion

  • utm_to_wgs84 – Convert UTM to lat, long coordinates.

  • wgs84_to_utm – Convert lat, long to UTM coordinates.

Saving

  • save – Save GCPs to an ascii file.

  • to_kml – Save GCPs to a kml file.

geophpy.geoposset.refsys_getlist()[source]

List of available geographic reference system.

geophpy.geoposset.filetype_getlist()[source]

List read file types, ‘ascii’, ‘shapefile’, …

geophpy.geoposset.utm_to_wgs84(easting, northing, zonenumber, zoneletter)[source]

Conversion from UTM to WGS84 coordinates (lat, lon).

Parameters
  • easting (scalar) – Easting UTM coordinate.

  • northing (scalar) – Northing UTM coordinate.

  • zonenumber (int) – UTM zone number.

  • zoneletter (str) – UTM zone letter.

Returns

  • latitude (scalar) – WGS84 latitude coordinate.

  • longitude (scalar) – WGS84 longitude coordinate.

geophpy.geoposset.wgs84_to_utm(latitude, longitude)[source]

Conversion from WGS84 to UTM coordinates.

works on list

Parameters
  • latitude (scalar) – WGS84 latitude coordinate.

  • longitude (scalar) – WGS84 longitude coordinate.

Returns

  • easting (scalar) – Easting UTM coordinate.

  • northing (scalar) – Northing UTM coordinate.

  • zonenumber (int) – UTM zone number.

  • zoneletter (str) – UTM zone letter.

geophpy.geoposset.utm_getzonelimits()[source]

UTM coordinates system min and max numbers and letters.

Returns

  • min_number (int) – Minimal number of the UTM zone (1).

  • min_letter (str) – Minimal letter of the UTM zone (E).

  • max_number (int) – Maximal number of the UTM zone (60).

  • max letter (str) – Maximal letter of the UTM zone (X).

geophpy.geoposset.isvalid_utm_letter(strg)[source]

Check validity of an UTM zone letter.

geophpy.geoposset.isvalid_utm_number(strg)[source]

Check validity of an UTM zone number.

class geophpy.geoposset.GeoPosSet(refsystem=None, utm_letter=None, utm_number=None, points_list=None)[source]

Class to manage geographic positioning set.

refsystem

Geographic reference system (‘UTM’, ‘WGS84’, …).

Type

str or None, opt

utm_zoneletter

Utm zone letter for ‘UTM’ refsystem (E -> X).

Type

str, opt

utm_zonenumber

Utm zone number for ‘UTM’ refsystem (1 -> 60).

Type

int, opt

points_list

List of Ground Control Points: >>> [[lat1, lon1, x1, y1], [lat2, lon2, x2, y2], …]

Type

list of scalar, opt

classmethod from_ascii_file(filenames, delimiter=None)[source]

Build a geophpy.geoposdet.GeoPosSet object from one or several ascii files.

Parameters
  • filenames (str or list of str) – Names of files to be read.

  • delimiter (str or None) – The ASCII file delimiter. If None (by default), the delimiter will be sniffed from the file itself.

Returns

  • GeoPosSet object (possibly empty).

  • succes (bool) – True if build was successful, False otherwise.

classmethod from_file(filenames, filetype=None)[source]

Build a GeoPosSet object from one or several files.

Parameters
  • filenames (str or list of str) – Names of files to be read.

  • filetype ({‘ascii’, ‘shapefile’, None}) – Type of the files to read. Id None (default), the file type will be determined from the file extension.

Returns

  • GeoPosSet object (possibly empty).

  • succes (bool) – True if build was successful, False otherwise.

plot(filename=None, dpi=None, transparent=False, i_xmin=None, i_xmax=None, i_ymin=None, i_ymax=None, long_label=False)[source]

Display GCPs.

Plots the GCPs using the point number as label. To save the plot, use the picturefilename option.

Parameters
  • filename (str or None) – Name of the file to save the picture. If None, no picture is saved.

  • dpi (int) – ‘dot per inch’ definition for the picture file if filename is not None.

  • transparent (bool) – if True, picture display points not plotted as transparents

  • i_xmin (x minimal value to display, None by default) –

  • i_xmax (x maximal value to display, None by default) –

  • i_ymin (y minimal value to display, None by default) –

  • i_ymax (y maximal value to display, None by default) –

  • long_label (bool) – Flag to display both point number and local coordinates.

Returns

  • success (True if no error)

  • fig (Figure object)

to_ascii(filename, delimiter=';')[source]

Save GeoPosSet points list to an ascii file.

Parameters
  • filename (str) – Name of the ascii file to save in.

  • delimiter (str, opt) – Delimiter to use.

Returns

successTrue if a file was saved.

Return type

bool

to_kml(filename)[source]

Save GeoPosSet points list to a kml file.

Parameters

filename (str) – Name for the kml file to save in.

Returns

successTrue if a file was saved.

Return type

bool