GMT.Gdal
— ModuleSmall subset of the GDAL and ArcGDAL packages but with no extra dependencies. For the time being this sub-module is not intended to much direct use except some documented functions. Interested people should consult the GDAL & ArchGDAL docs.
Base.contains
— Methodcontains(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns true
if g1 contains g2.
GMT.Gdal.arccircle
— Methodarccircle(x0, y0, radius, start_angle, end_angle; z0=0, inc=2, gdataset=false)
Parameters
x0
: center Xy0
: center Yradius
: radius of the circle.start_angle
: angle to first point on arc (clockwise of X-positive)end_angle
: angle to last point on arc (clockwise of X-positive)
Keywords
z0
: center Z. Optional, if not provided the output is flat 2Dinc
: the largest step in degrees along the arc. Default is 2 degreegdataset
: Returns a GDAL IGeometry even when input are GMTdataset or Matrix
Returns
A GMT dataset or a GDAL IGeometry
GMT.Gdal.arcellipse
— Methodarcellipse(x0, y0, primary_radius, secondary_radius, start_angle, end_angle; rotation=0, z0=0, inc=2, gdataset=false)
Parameters
x0
: center Xy0
: center Yprimary_radius
: X radius of ellipse.secondary_radius
: Y radius of ellipse.start_angle
: angle to first point on arc (clockwise of X-positive)end_angle
: angle to last point on arc (clockwise of X-positive)
Keywords
rotation
: rotation of the ellipse clockwise.z0
: center Z. Optional, if not provided the output is flat 2Dinc
: the largest step in degrees along the arc. Default is 2 degreegdataset
: Returns a GDAL IGeometry even when input are GMTdataset or Matrix
Returns
A GMT dataset or a GDAL IGeometry
GMT.Gdal.boundary
— Methodboundary(geom; gdataset=false)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgdataset
: Returns a GDAL IGeometry even when input are GMTdataset or Matrix
A new geometry object is created and returned containing the boundary of the geometry on which the method is invoked.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.buffer
— Functionbuffer(geom, dist::Real, quadsegs::Integer=30; gdataset=false)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixdist
: the buffer distance to be applied. Should be expressed into the same unit as the coordinates of the geometry.quadsegs
: the number of segments used to approximate a 90 degree (quadrant) of curvature.gdataset
: Returns a GDAL IGeometry even when input is a GMTdataset or Matrix
Compute buffer of geometry.
Builds a new geometry containing the buffer region around the geometry on which it is invoked. The buffer is a polygon containing the region within the buffer distance of the original geometry.
Some buffer sections are properly described as curves, but are converted to approximate polygons. The quadsegs
parameter can be used to control how many segments should be used to define a 90 degree curve - a quadrant of a circle. A value of 30 is a reasonable default. Large values result in large numbers of vertices in the resulting buffer geometry while small numbers reduce the accuracy of the result.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.centroid
— Methodcentroid(geom; gdataset=false)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of them), or a Matrixgdataset
: Returns a GDAL IGeometry even when input is a GMTdataset or Matrix
Compute the geometry centroid.
The centroid is not necessarily within the geometry.
(This method relates to the SFCOM ISurface::get_Centroid() method however the current implementation based on GEOS can operate on other geometry types such as multipoint, linestring, geometrycollection such as multipolygons. OGC SF SQL 1.1 defines the operation for surfaces (polygons). SQL/MM-Part 3 defines the operation for surfaces and multisurfaces (multipolygons).)
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.concavehull
— Functionconcavehull(geom, ratio, allow_holes::Bool=true; gdataset=false)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixratio
: Ratio of the area of the convex hull and the concave hull.allow_holes
: Whether holes are allowed.gdataset
: Returns a GDAL IGeometry even when input are GMTdataset or Matrix
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.convexhull
— Methodconvexhull(geom; gdataset=false)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgdataset
: Returns a GDAL IGeometry even when input are GMTdataset or Matrix
A new geometry object is created and returned containing the convex hull of the geometry on which the method is invoked.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.crosses
— Methodcrosses(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns true
if the geometries are crossing.
GMT.Gdal.delaunaytriangulation
— Methoddelaunay(geom::AbstractGeometry, tol::Real=0, onlyedges::Bool=true; gdataset=false)
Parameters
geom
: the geometry.tol
: optional snapping tolerance to use for improved robustnessonlyedges
: iftrue
, will return a MULTILINESTRING, otherwise it will return a GEOMETRYCOLLECTION containing triangular POLYGONs.gdataset
: Returns a GDAL IGeometry even when input is GMTdataset or Matrix
Return a Delaunay triangulation of the vertices of the geometry.
GMT.Gdal.difference
— Methoddifference(geom1, geom2; gdataset=false)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT typegdataset
: Returns a GDAL IGeometry even when input is GMTdataset or Matrix
Generates a new geometry which is the region of this geometry with the region of the other geometry removed.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.disjoint
— Methoddisjoint(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns true
if the geometries are disjoint.
GMT.Gdal.distance
— Methoddistance(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns the distance between the geometries or -1 if an error occurs.
GMT.Gdal.dither
— Functiondither(indata; n_colors=256, save="", gdataset=false)
Convert a 24bit RGB image to 8bit paletted.
- Use the
save=fname
option to save the result to disk in a GeoTiff filefname
. Iffname
has no extension a.tif
one will be appended. Alternatively give file names with extension.png
or.nc
to save the file in one of those formats. gdataset=true
: to return a GDAL dataset. The default is to return a GMTimage object.n_colors
: Select the number of colors in the generated color table. Defaults to 256.
GMT.Gdal.envelope
— Methodenvelope(geom)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrix
Computes and returns the bounding envelope for this geometry.
GMT.Gdal.envelope3d
— Methodenvelope3d(geom)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrix
Computes and returns the bounding envelope (3D) for this geometry
GMT.Gdal.equals
— Methodequals(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns true
if the geometries are equivalent.
GMT.Gdal.fetchbool
— Methodfetchbool(strlist::Vector{String}, name::String)
In a StringList of "Name=Value" pairs, look to see if there is a key with the given name, and if it can be interpreted as being TRUE. If the key appears without any "=Value" portion it will be considered true. If the value is NO, FALSE or 0 it will be considered FALSE otherwise if the key appears in the list it will be considered TRUE. If the key doesn't appear at all, the indicated default value will be returned.
GMT.Gdal.fillnodata!
— Methodfillnodata!(data::GItype; nodata=nothing, kwargs...)
Fill selected raster regions by interpolation from the edges.
Parameters
data
: Input data. It can be a file name, a GMTgrid or GMTimage object.nodata
: The nodata value that will be used to fill the regions. Otherwise use thenodata
attribute ofindata
if it exists, or NaN if none of the above were set.kwargs
:- band: the band number. Default is first layer in
indata
- maxdist: the maximum number of cels to search in all directions to find values to interpolate from. Default, fills all.
- nsmooth: the number of 3x3 smoothing filter passes to run (0 or more).
- band: the band number. Default is first layer in
Returns
The modified input data
GMT.Gdal.fillnodata
— MethodGI = fillnodata(data::String; nodata=nothing, kwargs...) -> GMTgrid or GMTimage
Fill selected raster regions by interpolation from the edges.
Parameters
data
: Input data. The file name of a grid or image that can be read withgmtread
.nodata
: The nodata value that will be used to fill the regions. Otherwise use thenodata
attribute ofindata
if it exists, or NaN if none of the above were set.kwargs
:- band: the band number. Default is first layer in
indata
- maxdist: the maximum number of cels to search in all directions to find values to interpolate from. Default, fills all.
- nsmooth: the number of 3x3 smoothing filter passes to run (0 or more).
- band: the band number. Default is first layer in
Returns
A GMTgrid or GMTimage object with the band
nodata values filled by interpolation.
GMT.Gdal.gdaldem
— Functiongdaldem(dataset, method, options=String[]; dest="/vsimem/tmp", color=name|GMTcpt, kw...)
Tools to analyze and visualize DEMs.
Parameters
dataset
The source dataset.method
the processing to apply (one of "hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "Roughness").options
List of options (potentially including filename and open options). The accepted options are the ones of the gdaldem utility.
Keyword Arguments
color
color file (mandatory for "color-relief" processing, should be empty otherwise). Ifcolor
is just a CPT name we compute a CPT from it and the input grid.kw...
keyword=value arguments whenmethod
is hillshade.
Returns
A GMT grid or Image, or a GDAL dataset (or nothing if file was writen on disk).
GMT.Gdal.gdalgrid
— FunctionG = gdalgrid(indata, method::StrSymb="", options=String[]; dest="/vsimem/tmp", kw...)
Parameters
indata
: The source dataset. It can be a file name, a GMTdataset, a Mx3 matrix or a GDAL datasetmethod
: The interpolation method name. One of "invdist", "invdistnn", "average", "nearest", "linear", "minimum", "maximum", "range", "count", "averagedistance", "averagedistance_pts".options
: List of options. The accepted options are the ones of the gdal_grid utility. This list can be in the form of a vector of strings, or joined in a single string.kwargs
: Thekwargs
may also contain the GMT region (-R), inc (-I) andsave=fname
options.
Returns
A GMTgrid or a GDAL dataset (or nothing if file was writen on disk). To force the return of a GDAL dataset use the option gdataset=true
.
GMT.Gdal.gdaltranslate
— Functiongdaltranslate(indata, options=String[]; dest="/vsimem/tmp", kwargs...)
Convert raster data between different formats and other operations also provided by the GDAL 'gdal_translate' tool. Namely sub-region extraction and resampling. The kwargs
options accept the GMT region (-R), increment (-I), target SRS (-J). Any of the keywords outgrid
, outfile
or save
= outputname options to make this function save the result in disk in the file 'outputname'. The file format is picked from the 'outputname' file extension. When no output file name is provided it returns a GMT object (either a grid or an image, depending on the input type). To force the return of a GDAL dataset use the option gdataset=true
.
indata
: Input data. It can be a file name, a GMTgrid or GMTimage object or a GDAL datasetoptions
: List of options. The accepted options are the ones of the gdal_translate utility. This list can be in the form of a vector of strings, or joined in a single string.kwargs
: Besides what was mentioned above one can also usemeta=metadata
, wheremetadata
is a string vector with the form "NAME=...." for each of its elements. This data will be recognized by GDAL as Metadata. Thekwargs
may also contain the GMT region (-R), proj (-J), inc (-I) andsave=fname
options.
Returns
A GMT grid or Image, or a GDAL dataset (or nothing if file was writen on disk).
GMT.Gdal.gdalvectortranslate
— Functionogr2ogr(indata, options=String[]; dest="/vsimem/tmp", kwargs...)
Parameters
indata
The source dataset.options
List of options (potentially including filename and open options). The accepted options are the ones of the gdalwarp utility.kw
are kwargs that may contain the GMT region (-R), proj (-J), inc (-I) andsave=fname
options
Returns
A GMT dataset, or a GDAL dataset (or nothing if file was writen on disk).
GMT.Gdal.gdalwarp
— Functiongdalwarp(indata, options=String[]; dest="/vsimem/tmp", kwargs...)
Image/Grid reprojection and warping function.
Parameters
indata
: Input data. It can be a file name, a GMTgrid or GMTimage object or a GDAL datasetoptions
: List of options. The accepted options are the ones of the gdal_translate utility. This list can be in the form of a vector of strings, or joined in a single string. The accepted options are the ones of the gdalwarp utility.kwargs
: Besides what was mentioned above one can also usemeta=metadata
, wheremetadata
is a string vector with the form "NAME=...." for each of its elements. This data will be recognized by GDAL as Metadata. Thekwargs
may also contain the GMT region (-R), proj (-J), inc (-I) andsave=fname
options.
Returns
A GMT grid or Image, or a GDAL dataset (or nothing if file was writen on disk).
GMT.Gdal.geodesicarea
— Methodgeodesicarea(geom)
Compute geometry area, considered as a surface on the underlying ellipsoid of the SRS attached to the geometry. The returned area will always be in square meters, and assumes that polygon edges describe geodesic lines on the ellipsoid. If the geometry' SRS is not a geographic one, geometries are reprojected to the underlying geographic SRS of the geometry' SRS.
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrix
Returns the area of the geometry in square meters or a negative value in case of error for unsupported geometry types.
GMT.Gdal.geomarea
— Methodgeomarea(geom)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrix
Returns the area of the geometry or 0.0 for unsupported geometry types.
GMT.Gdal.geomlength
— Methodgeomlength(geom)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrix
Returns the length of the geometry, or 0.0 for unsupported geometry types.
GMT.Gdal.intersection
— Methodintersection(geom1, geom2; gdataset=false)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT typegdataset
: Returns a GDAL IGeometry even when input is GMTdataset or Matrix
Returns a new geometry representing the intersection of the geometries, or NULL if there is no intersection or an error occurs.
Generates a new geometry which is the region of intersection of the two geometries operated on. The intersects
function can be used to test if two geometries intersect.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.intersects
— Methodintersects(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns whether the geometries intersect
Determines whether two geometries intersect. If GEOS is enabled, then this is done in rigorous fashion otherwise true
is returned if the envelopes (bounding boxes) of the two geometries overlap.
GMT.Gdal.overlaps
— Methodoverlaps(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns true
if the geometries overlap.
GMT.Gdal.pointalongline
— Methodpointalongline(geom, distance::Real; gdataset=false)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixdistance
: distance along the curve at which to sample position. This distance should be between zero and geomlength() for this curve.gdataset
: Returns a GDAL IGeometry even when input are GMTdataset or Matrix
Fetch point (or NULL) at given distance along curve.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.polygonize
— MethodD = polygonize(data::GItype; kwargs...) -> Vector{GMTdataset}
This method, which uses the GDAL GDALPolygonize function, creates vector polygons for all connected regions of pixels in the raster sharing a common pixel/cell value. The input may be a grid or an image. This function can be rather slow as it picks lots of polygons in pixels with slightly different values at transitions between colors. Its natural use is to digitize masks images.
Parameters
data
: Input data. It can be a GMTgrid or GMTimage object.kwargs
:min, nmin, npixels or ncells
: The minimum number of cells/pixels for a polygon to be retained. Default is 1. This can be set to filter out small polygons.min_area
: Minimum area in m2 for a polygon to be retained. This option takes precedence over the one above that is based in the counting of cells. Note also that this is an approximate value because at this point we still don't know exactly the latitudes of the polygons.max_area
: Maximum area in m2 for a polygon to be retained.simplify
: Apply the Douglas-Peucker line simplification algorithm to the poligons. Provide a tolerence in meters. For example:simplify=0.5
. But be warned that this is a risky option since a too large tolerance
can lead to loss of otherwise good polygons. A good rule of thumb is to use the cell size for the tolerance.
And in fact that is what we do when using `simplify=:auto`.
sort
: If true, will sort polygons by pixel count. Default is the order that GDAL decides internally.
GMT.Gdal.polygonize
— Methodpolygonize(geom; gdataset=false)
Parameters
geom
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgdataset
: Returns a GDAL IGeometry even when input are GMTdataset or Matrix
Polygonizes a set of sparse edges.
A new geometry object is created and returned containing a collection of reassembled Polygons: NULL will be returned if the input collection doesn't correspond to a MultiLinestring, or when reassembling Edges into Polygons is impossible due to topological inconsistencies.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.polyunion
— Methodpolyunion(geom1, geom2; gdataset=false)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT typegdataset
: Returns a GDAL IGeometry even when input is GMTdataset or Matrix
Computes a new geometry representing the union of the geometries.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.setproj!
— Functionsetproj!(type, proj)
Set a referencing system to the type
object. This object can be a GMTgrid
, a GMTimage
, a GMTdataset
or an AbstractDataset
.
proj
Is either a Proj4 string or a WKT. Alternatively, it can also be another grid, image or dataset type, in which case its referencing system is copied intotype
GMT.Gdal.simplify
— Methodsimplify(geom::AbstractGeometry, tol::Real; gdataset=false)
Compute a simplified geometry.
Parameters
geom
: the geometry.tol
: the distance tolerance for the simplification.gdataset
: Returns a GDAL IGeometry even when input is GMTdataset or Matrix
GMT.Gdal.symdifference
— Methodsymdifference(geom1, geom2; gdataset=false)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT typegdataset
: Returns a GDAL IGeometry even when input is GMTdataset or Matrix
Generates a new geometry representing the symmetric difference of the geometries or NULL if the difference is empty or an error occurs.
Returns
A GMT dataset when input is a Matrix or a GMT type (except if gdaset=true
), or a GDAL IGeometry otherwise
GMT.Gdal.touches
— Methodtouches(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns true
if the geometries are touching.
GMT.Gdal.within
— Methodwithin(geom1, geom2)
Parameters
geom1
: the geometry. This can either be a GDAL AbstractGeometry or a GMTdataset (or vector of it), or a Matrixgeom2
: Second geometry. AbstractGeometry ifgeom1::AbstractGeometry
or a GMTdataset/Matrix ifgeom1
is GMT type
Returns true
if g1 is contained within g2.
GMT.Gdal.wrapgeom
— Functionds = wrapgeom(geom::AbstractGeometry, proj="") -> Dataset
Wrap a geometry type into a GDAL dataset. Optionaly provide the SRS (proj4) via the PROJ option.
Handy function for saving a geometry on disk or visualize it with plot()
GMT.Drawing
— ModuleSubmodule where the symbols of plot
were elevated to the category of functions. The functions that are currently available are:
- circle(x, y, diameter, kw...)
- cross(x, y, diameter; kw...)
- custom(x, y, name, size; kw...)
- diamond(x, y, diameter; kw...)
- hexagon(x, y, diameter; kw...)
- itriangle(x, y, diameter; kw...)
- letter(x, y, size, str, font, just; kw...)
- minus(x, y, length; kw...)
- pentagon(x, y, diameter; kw...)
- plus(x, y, diameter; kw...)
- square(x, y, diameter; kw...)
- star(x, y, diameter; kw...)
- triangle(x, y, diameter; kw...)
- ydash(x, y, length; kw...)
- box(x, y, width, height; kw...)
- rect(x, y, width, height; kw...)
- ellipse(x, y, angle, majoraxis, minoraxis; kw...)
- ellipseAz(x, y, azimuth, majoraxis, minoraxis; kw...)
- rotrect(x, y, angle, width, height; kw...)
- rotrectAz(x, y, azimuth, width, height; kw...)
- roundrect(x, y, width, height, radius; kw...)
For all symbols, except box
, diameter
is the diameter of the circumscribing circle and x,y
the coordinates of its center. box
is the exception in that those are the coordinates of the lower left corner.
This submodule uses global variables to track the first, middle and last layers in the stack plot but in case of errors that track may be left in error state too. So, when one want to force the begining of a new figure use the kwarg first=true
. Likewise, if we want to add to a previously, still open fig, use first=false
.
By default the plot unites is $cm$ but we can select $points$ by doing units=:points
. This takes care of setting the appropriate region
(A4 by default) and fig scale. If other then A4 size is wished, use paper=:A3
(or any of the common paper sizes). When units is left to $cm$ the normal paper size ruple applies (i.e. A4 for PS format or ~unlimitted for others.)
The kw...
in the functions arguments are the normal kwargs that one can use in the plot
module.
Example, to draw a cute litte car:
ellipse(300,201,0, 200, 50, units=:points, fill=:purple, pen=1)
ellipse(340,206, 0,130, 66, fill=:purple, pen=1)
ellipse(318,222,0, 60, 26, fill=:blue)
box(200, 173, 205, 26, fill=:purple, pen=1)
circle(305,185,56, fill=:black)
circle(305,185,36, fill=:gray50)
circle(400,185,56, fill=:black)
circle(400,185,36, fill=:gray50, show=true)
GMT.GMT
— ModuleGMT manipulating geographic and Cartesian data sets (including filtering, trend fitting, gridding, projecting, etc.) and producing high quality illustrations.
Full modules list and docs in terse GMT style at http://docs.generic-mapping-tools.org/latest/
Documentation for GMT.jl at https://www.generic-mapping-tools.org/GMT.jl/latest/
GMT.GMTcpt
— Typemutable struct GMTcpt
The fields of this struct are:
colormap::Array{Float64,2}
: Mx3 matrix equal to the first three columns of cptalpha::Array{Float64,1}
: Vector of alpha values. One for each color.range::Array{Float64,2}
: Mx2 matrix with z range for each sliceminmax::Array{Float64,1}
: Two elements Vector with zmin,zmaxbfn::Array{Float64,2}
: A 3x3(4?) matrix with BFN colors (one per row) in [0 1] intervaldepth::Cint
: Color depth: 24, 8, 1hinge::Cdouble
: Z-value at discontinuous color break, or NaNcpt::Array{Float64,2}
: Mx6 matrix with r1 g1 b1 r2 g2 b2 for z1 z2 of each sliceegorical::Int
: Is this CPT categorical? 0 = No, 1 = Yes, 2 = Yes and keys are strings.label::Vector{String}
: Labels of a Categorical CPTkey::Vector{String}
: Keys of a Categorical CPTmodel::String
: String with color model rgb, hsv, or cmyk [rgb]comment::Vector{String}
: Cell array with any comments
GMT.GMTdataset
— Typemutable struct GMTdataset{T<:Real, N} <: AbstractArray{T,N}
The GMTdataset type is how tables, (geo)referenced or not, communicate in/out with the GMT and GDAL libraries. They implement the AbstractArray and Tables interface.
The fields of this struct are:
data::Array{T,N}
: Mx2 Matrix with segment datads_bbox::Vector{Float64}
: Global BoundingBox (for when there are many segments)bbox::Vector{Float64}
: Segment BoundingBoxattrib::Dict{String, Union{String, Vector{String}}}
: Dictionary with attributes/values (optional)colnames::Vector{String}
: Column names. Antecipate using this with a future Tables inerfacetext::Vector{String}
: Array with text after data coordinates (mandatory only when plotting Text)header::String
: String with segment header (Optional but sometimes very useful)comment::Vector{String}
: Array with any dataset comments [empty after first segment]proj4::String
: Projection string in PROJ4 syntax (Optional)wkt::String
: Projection string in WKT syntax (Optional)epsg::Int
: EPSG projection code (Optional)geom::Integer
: Geometry type. One of the GDAL's enum (wkbPoint, wkbPolygon, etc...)
GMT.GMTgrid
— Typemutable struct GMTgrid{T<:Number,N} <: AbstractArray{T,N}
The GMTgrid type is how grids, 2D or multi-layered, (geo)referenced or not, communicate in/out with the GMT and GDAL libraries. They implement the AbstractArray interface.
The fields of this struct are:
proj4::String
: Projection string in PROJ4 syntax (Optional)wkt::String
: Projection string in WKT syntax (Optional)epsg::Int
: EPSG codegeog::Int
: Is geographic coords? 0 -> No; 1 -> [-180 180]; 2 -> [0 360]range::Vector{Float64}
: 1x6[8] vector with [xmin, xmax, ymin, ymax, zmin, zmax [, vmin, vmax]]inc::Vector{Float64}
: 1x2[3] vector with [xinc, yinc [,v_inc]]registration::Int
: Registration type: 0 -> Grid registration; 1 -> Pixel registrationnodata::Union{Float64, Float32}
: The value of nodatatitle::String
: Title (Optional)comment::String
: Remark (Optional)command::String
: Command used to create the grid (Optional)cpt::String
: Name of a recommended GMT CPT name for this grid.names::Vector{String}
: To use whith multi-layered and when layers have names (Optional)x::Vector{Float64}
: [1 x n_columns] vector with XX coordinatesy::Vector{Float64}
: [1 x n_rows] vector with YY coordinatesv::Union{Vector{<:Real}, Vector{String}}
: [v x n_bands] vector with VV (vertical for 3D grids) coordinatesz::Array{T,N}
: [nrows x ncolumns] grid arrayx_unit::String
: Units of XX axis (Optional)y_unit::String
: Units of YY axis (Optional)v_unit::String
: Units of Vertical axis (Optional)z_unit::String
: Units of z vlues (Optional)layout::String
: A three character string describing the grid memory layoutscale::Union{Float64, Float32}=1f0
: When saving in file applyz = z * scale + offset
offset::Union{Float64, Float32}=0f0
pad::Int=0
: When != 0 means that the array is placed in a padded array of PAD rows/colshasnans::Int=0
: 0 -> "don't know"; 1 -> confirmed, "have no NaNs"; 2 -> confirmed, "have NaNs"
GMT.GMTimage
— Typemutable struct GMTimage{T<:Union{Unsigned, Bool}, N} <: AbstractArray{T,N}
The GMTimage type is how images (UInt8, UInt16), 2D or multi-layered, (geo)referenced or not, communicate in/out with the GMT and GDAL libraries. They implement the AbstractArray interface.
The fields of this struct are:
proj4::String
: Projection string in PROJ4 syntax (Optional)wkt::String
: Projection string in WKT syntax (Optional)epsg::Int
: EPSG codegeog::Int
: Is geographic coords? 0 -> No; 1 -> [-180 180]; 2 -> [0 360]range::Vector{Float64}
: 1x6[8] vector with [xmin, xmax, ymin, ymax, zmin, zmax [, vmin, vmax]]inc::Vector{Float64}
: 1x2[3] vector with [xinc, yinc [,v_inc]]registration::Int
: Registration type: 0 -> Grid registration; 1 -> Pixel registrationnodata::Float32
: The value of nodatacolor_interp::String
: If equal to "Gray" an indexed image with no cmap will get a gray cmapmetadata::Vector{String}
: To store any metadata that can eventually be passed to GDAL (Optional)names::Vector{String}
: To use whith multi-band and when bands have names (Optional)x::Vector{Float64}
: [1 x n_columns] vector with XX coordinatesy::Vector{Float64}
: [1 x n_rows] vector with YY coordinatesv::Vector{Float64}
: [v x n_bands] vector with vertical coords or wavelengths in hypercubes (Optional)image::Array{T,N}
: [nrows x ncolumns x n_bands] image arraylabels::Vector{String}
: Labels of a Categorical CPTn_colors::Int
: Number of colors stored in the vector 'colormap'colormap::Vector{Int32}
: A vector with n_colors-by-4 saved column-wisealpha::Matrix{UInt8}
: A [nrows x ncolumns] alpha arraylayout::String
: A four character string describing the image memory layoutpad::Int
: When != 0 means that the array is placed in a padded array of PAD rows/cols
GMT.GMTps
— Typemutable struct GMTps
The fields of this struct are:
postscript::String
: Actual PS plot (text string)length::Int
: Byte length of postscriptmode::Int
: 1 = Has header, 2 = Has trailer, 3 = Has bothcomment::Vector{String}
: A vector with any eventual comments
Base.:!
— MethodCompute the logical complement of a boolean GMTimage. Inherits metadata from input image.
Base.:&
— MethodIntersect two boolean/uint8 mask images. It applies the logical I1 && I2
operation. Inherit header parameters from I1 image
Base.:+
— MethodAdd two boolean mask/uint8 images. It applies the logical I1 || I2
operation. Inherit header parameters from I1 image
The infix operation I1 | I2
is a synonym for +(I1,I2)
.
Base.delete!
— Methoddelete!(d::Dict, symbs::Vector{T}) where T
example
delete!(d, [:a :b]) delete!(d, [:a, :b]) delete!(d, [[:a, :b], [:c]]) delete!(d, [[:a :b] [:c]])
Base.xor
— MethodBitwise exclusive or of I1
and I2
boolean images. Inherits metadata from I1
.
The infix operation I1 ⊻ I2
is a synonym for xor(I1,I2)
, and ⊻
can be typed by tab-completing \xor
or \veebar
in the Julia REPL.
GMT.ISOtime2unix
— Methodt = ISOtime2unix(ts::AbstractString) -> Float64
Take a string representing a time and return the equivalent Unix time. The ts
string may take one of these forms:
- "YYYY-mm-dd", or "YYYY-mm-ddThh", or "YYYY-mm-ddThh:mm", or "YYYY-mm-ddThh:mm:ss", or "dd-Jan-YY" or "dd-Jan-YYYY"
Examples
using Dates
t = ISOtime2unix("2019-01-01T12")
1.546344e9
t = ISOtime2unix("25-Apr-1974")
1.3608e8
GMT.Normal
— MethodNormal(x::Vector{<:Real}) # standard Normal distribution with zero mean and unit variance
Normal(x, μ) # Normal distribution with mean μ and unit variance
Normal(x, μ, σ) # Normal distribution with mean μ and variance σ^2
GMT.ODE2ds
— MethodD = ODE2ds(sol; interp=0)
Extract data from a DifferentialEquations solution type and return it into a GMTdataset.
interp
: == 0 means we return the original points (no interpolation). == 2 => do data interpolation to the double of original number of points. == 3 => three times, == n => n times.
GMT.Uniform
— FunctionUniform(x::Vector{<:Real}, a=-1.0, b=1.0) # Uniform distribution over [a, b]
GMT.ablines
— Methodablines(a, b; kw...)
or
ablines([a1, a2, ..., an], [b1, b2, ..., bn]; kw...)
or
ablines(D::GMTdataset; kw...)
Creates a straight line(s) defined by Y = a + b * X. Input can be a pair of a,b
parameters or a vector of them, case in which multiple straight lines are plotted. Plot limits are passed through the usual region
option in kw
or, if missing, we plot lines in the x = [0 10] interval. The third form, when input is a GMTdataset
type implies that this was computed with the linearfitxy
function, which embeds the linear fit parameters in the data type attributes. All plot
options are available via the kw
arguments.
Examples:
ablines([1, 2, 3], [1, 1.5, 2], linecolor=[:red, :orange, :pink], linestyle=:dash, linewidth=2, show=true)
D = linearfitxy([0.0, 0.9, 1.8, 2.6, 3.3, 4.4, 5.2, 6.1, 6.5, 7.4], [5.9, 5.4, 4.4, 4.6, 3.5, 3.7, 2.8, 2.8, 2.4, 1.5],
sx = 1 ./ sqrt.([1000., 1000, 500, 800, 200, 80, 60, 20, 1.8, 1]), sy=1 ./
sqrt.([1., 1.8, 4, 8, 20, 20, 70, 70, 100, 500]));
plot(D, linefit=true, band_ab=true, band_CI=true, ellipses=true, Vd=2)
plot!(D, linefit=true, Vd=2)
ablines!(D, Vd=2)
ablines!(0,1, Vd=2)
GMT.add2PSfile
— Methodadd2PSfile(text)
Add commands to the GMT PostScript file while it is not yet finished.
text
: is a string, with optional line breaks in it, or a vector of strings.
This option is for PostScript gurus that want/need to mess with the PS plot file in the middle of its construction.
GMT.append2fig
— Methodappend2fig(fname::String)
Move the file fname
to the default name and location (GMT_user.ps in tmp). The fname
should be a PS file that has NOT been closed. Posterior calls to plotting methods will append to this file. Useful when creating figures that use a common base map that may be heavy (slow) to compute.
GMT.arrows
— Functionarrows(cmd0::String="", arg1=nothing; arrow=(...), kwargs...)
Plots an arrow field. When the keyword arrow=(...)
or vector=(...)
is used, the direction (in degrees counter-clockwise from horizontal) and length must be found in columns 3 and 4, and size, if not specified on the command-line, should be present in column 5. The size is the length of the vector head. Vector stem width is set by option pen
or line_attrib
.
The vecmap=(...)
variation is similar to above except azimuth (in degrees east of north) should be given instead of direction. The azimuth will be mapped into an angle based on the chosen map projection. If length is not in plot units but in arbitrary user units (e.g., a rate in mm/yr) then you can use the input_col option to scale the corresponding column via the +sscale modifier.
The geovec=(...)
or geovector=(...)
keywords plot geovectors. In geovectors, azimuth (in degrees east from north) and geographical length must be found in columns 3 and 4. The size is the length of the vector head. Vector width is set by pen
or line_attrib
. Note: Geovector stems are drawn as thin filled polygons and hence pen attributes like dashed and dotted are not available. For allowable geographical units, see the units=()
option.
The full arrow
options list can be consulted at Vector Attributes
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
W | pen | line_attrib :: [Type => Str]
Set pen attributes for lines or the outline of symbols
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
Example:
arrows([0 8.2 0 6], limits=(-2,4,0,9), arrow=(len=2,stop=1,shape=0.5,fill=:red), axis=:a, pen="6p", show=true)
GMT.axes2pix
— Functionpix_x, pix_y = axes2pix(xy, dims, x, y, reg=0, layout::String="TC")
Convert axes coordinates to pixel/cell coordinates.
xy
: A Mx2 matrix with x & y coordinates in same units as those in thex,y
vectorsx,y: should be the coordinate vectors of a GMTgrid or GMTimage types
dims
: Tuple with the number of rows,columns as returned by size(GI)
Return two vectors of Int with the indices that map xy
to x
and y
GMT.band
— Functionband(cmd0::String="", arg1=nothing; width=0.0, envelope=false, kwargs...)
Plot a line with a symmetrical or asymmetrical band around it. If the band is not color filled then, by default, only the envelope outline is plotted.
Example: Plot the sinc function with a green band of width 0.1 (above and below the sinc line)
x = y = -10:0.11:10;
band(x, sin.(x)./x, width=0.1, fill="green@80", show=true)
or, the same but using a function
band(x->sin(x)/x, 10, width=0.1, fill="green@80", show=true)
GMT.bar
— Functionbar(cmd0::String="", arg1=nothing; kwargs...)
Reads a file or (x,y) pairs and plots vertical bars extending from base to y.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
fill :: [Type => Str –
Select color or pattern for filling the bars
base | bottom :: [Type => Str | Num] $key=value$
By default, base = ymin. Use this option to change that value. If base is not appended then we read it. from the last input data column.
size | width :: [Type => Str | Num] $key=value$
The size or width is the bar width. Append u if size is in x-units. When width is used the default is plot-distance units.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
Example:
bar(sort(randn(10)), fill=:black, axis=:auto, show=true)
GMT.bar3
— Functionbar3(cmd0::String="", arg1=nothing; kwargs...)
Read a grid file, a grid or a MxN matrix and plots vertical bars extending from base to z.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
fill :: [Type => Str] $key=color$
Select color or pattern for filling the bars
base :: [Type => Str | Num] $key=value$
By default, base = ymin. Use this option to change that value. If base is not appended then we read it.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
Example:
G = gmt("grdmath -R-15/15/-15/15 -I0.5 X Y HYPOT DUP 2 MUL PI MUL 8 DIV COS EXCH NEG 10 DIV EXP MUL =");
bar3(G, lw=:thinnest, show=true)
GMT.basemap
— Methodbasemap(; kwargs...)
Plot base maps and frames.
See full GMT (not the jl
one) docs at psbasemap
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
A | polygon :: [Type => Str | []]
No plotting is performed. Instead, we determine the geographical coordinates of the polygon outline for the (possibly oblique) rectangular map domain.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
inset :: [Type => NamedTuple]
Draw a simple map insert box on the map.
F | box :: [Type => Str]
Without further options, draws a rectangular border around any map insert (D), map scale (L) or map rose (T)
Jz | zscale | zsize :: [Type => String]
L | map_scale :: [Type => Str]
Draw a map scale.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Td | rose :: [Type => Str]
Draws a map directional rose on the map at the location defined by the reference and anchor points.
Tm | compass :: [Type => Str]
Draws a map magnetic rose on the map at the location defined by the reference and anchor points.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
To see the full documentation type: $@? basemap$
GMT.binarize
— MethodIbw = binarize(I::GMTimage, threshold; band=1, revert=false) -> GMTimage
Converts an image to a binary image (black-and-white) using a threshold. If revert=true
, values below the threshold are set to 255, and values above the threshold are set to 0. If the I
image has more than one band, use band
to specify which one to binarize.
GMT.binstats
— Functionbinstats(cmd0::String="", arg1=nothing; kwargs...)
Reads arbitrarily located (x,y[,z][,w]) points (2-4 columns) and for each node in the specified grid layout determines which points are within the given radius. These point are then used in the calculation of the specified statistic. The results may be presented as is or may be normalized by the circle area to perhaps give density estimates. Alternatively, select hexagonal tiling instead or a rectangular grid layout.
See full GMT (not the GMT.jl
one) docs at gmtbinstats
Parameters
C | stats | statistic :: [Type => String | NamedTuple]
Choose the statistic that will be computed per node based on the points that are within radius distance of the node.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
E | empty :: [Type => Number]
Set the value assigned to empty nodes [NaN].
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = gmtbinstats(....) form.
N | normalize :: [Type => Bool]
Normalize the resulting grid values by the area represented by the
search_radius
.S | search_radius :: [Type => Number]
Sets the search_radius that determines which data points are considered close to a node. Not compatible with
tiling
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
T | tiling | bins :: [Type => String | NamedTuple]
Instead of circular, possibly overlapping areas, select non-overlapping tiling. Choose between rectangular hexagonal binning.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | weights :: [Type => Bool | String]
Input data have a 4th column containing observation point weights.
a | aspatial :: [Type => Str] $Arg = [col=]name[…]$
Control how aspatial data are handled in GMT during input and output.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
q | inrow | inrows :: [Type => Str] $Arg = [i|o][~]rows[+ccol][+a|f|s]$
Select specific data rows to be read (-qi [Default]) or written (-qo) [all].
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? gmtbinstats$
GMT.blendimg!
— Methodblendimg!(color::GMTimage, shade::GMTimage; new=false, mode="", transparency=0.5, white=220, burn_up=180, screen_low=200)
Blend color
GMTimage that is normally a RGB image with the shade
intensity image (normally obtained with gdaldem or Blender ray tracer). However, for certain blender modes both $color$ or $shade$ can be RGB or grayscale images. It is highly instructive to watch this YouTube video on how to combine the "LinearBurn" and the "Screen" modes to create stunning "Shaded relief" effects. https://somethingaboutmaps.wordpress.com/2014/10/26/adding-shaded-relief-in-photoshop/
mode
:mode=""
ormode="gcalc"
: The blending method is the one explained at https://gis.stackexchange.com/questions/255537/merging-hillshade-dem-data-into-color-relief-single-geotiff-with-qgis-and-gdal/255574#255574mode="blend"
: Simple 50% (default) blend is performed. Settransparency
to other value in the ]0 1[ range to weight more one of the images. 0.75 will makeimg
weight 3/4 of the total sum, and so forth.mode="LinearBurn"
: (Same as Photoshop blender LinearBurn) Adds the pixel values of the upper and lower layers and then subtracts 255. It tends to make the image darker. Theburn_up
option sets the threshold value of $shade$ above which the $color$ image is not modified.mode="ColorBurn"
: (Same as Photoshop blender ColorBurn) It inverts the pixel value of $color$ layer, divides that by the pixel value of the $shade$, then inverts the result. It tends to make the image darker.mode="Screen"
: (Same as Photoshop blender Screen) Inverts the values of each of the visible pixels in the two images. (That is, it subtracts each of them from 255) Then it multiplies them together, and inverts this value again. The resulting image is usually brighter, and sometimes “washed out” in appearance. To control this washing effect, use thescreen_low
option that sets the threshold value of $shade$ below which the $color$ image is not modified. Note, this value is very case dependent and normally requires some trial and error to find the right value. A second way of controlling the washing effect is to use thewhite
option different from 255. The default here iswhite=220
which makes the added bright be less bright.
new
: If true returns a new GMTimage object, otherwise it changes thecolor
content.
GMT.blockmean
— Methodblockmean(cmd0::String="", arg1=nothing; kwargs...)
Block average (x,y,z) data tables by L2 norm.
See full GMT (not the GMT.jl
one) docs at blockmean
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
A | field | fields :: [Type => Str]
Select which fields to write to individual grids. Append comma-separated codes for available fields: z (the mean data z, but see statistic), s (standard deviation), l (lowest value), h (highest value) and w (the output weight; requires weights). [Default is just z].
C | center :: [Type => Bool]
Use the center of the block as the output location [Default uses the mean location]. Not used when -A
E | extend | extended :: [Type => Str | []]
Provide Extended report which includes s (the standard deviation about the mean), l, the lowest value, and h, the high value for each block. Output order becomes x,y,z,s,l,h[,w]. [Default outputs x,y,z[,w]. See -W for w output. If -Ep is used we assume weights are 1/(sigma squared) and s becomes the propagated error of the mean.
G | save | outgrid | outfile :: [Type => Str]
Write one or more fields directly to grids on disk; no table data are return. If more than one fields are specified via A then grdfile must contain the format flag %s so that we can embed the field code in the file names. If not provided but A is used, return 1 or more GMTgrid type(s).
S | statistic :: [Type => Str | Symb]
Use
statistic=:n
to report the number of points inside each block,statistic=:s
to report the sum of all z-values inside a block,statistic=:w
to report the sum of weights [Default (orstatistic=:m
reports mean value].mean :: [Type => Any]
Report the mean value of points inside each block
npts | counts :: [Type => Any]
Report the number of points inside each block
sum :: [Type => Any]
Report the sum of all z-values inside each block
sum_weights :: [Type => Any]
Report the the sum of weights
grid :: [Type => Bool]
With any of the above options (
statistic
,npts
,sum
) this option makes it return a grid instead of a GMTdataset.W | weights :: [Type => Str | []]
Unweighted input and output have 3 columns x,y,z; Weighted i/o has 4 columns x,y,z,w. Weights can be used in input to construct weighted mean values for each block.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
q | inrow | inrows :: [Type => Str] $Arg = [i|o][~]rows[+ccol][+a|f|s]$
Select specific data rows to be read (-qi [Default]) or written (-qo) [all].
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.blockmedian
— Methodblockmedian(cmd0::String="", arg1=nothing; kwargs...)
Block average (x,y,z) data tables by L1 norm.
See full GMT (not the GMT.jl
one) docs at blockmedian
GMT.blockmode
— Methodblockmode(cmd0::String="", arg1=nothing; kwargs...)
Block average (x,y,z) data tables by mode estimation.
See full GMT (not the GMT.jl
one) docs at blockmode
GMT.boxplot
— Methodboxplot(data, grp=[]; pos=nothing, kwargs...)
data
: A vector (plots a single box), a Matrix (plots n columns boxes), a MxNxG (plotsG
groups) ofN
columns boxes, a Vector{Vector} (plots n clumn boxes but from data of different sizes), a Vector{Vector{Vector}} (plots G groups - length(data) -, where groups may have variable number of elements and each have its own size.)grp
: Categorical vector (made of integers or text strings) used to break down a the data column vector in cathegories (groups).pos
: a coordinate vector (or a single location whendata
is a vector) where to plot the boxes. Default plots them at 1:nboxes or 1:ngroups.ccolor
: Logical value indicating whether the groups have constant color (whenfill=true
is used) or have variable color (the default).fill
: If fill=true paint the boxes with a pre-defined color scheme. Otherwise, give a list of colors to paint the boxes.fillalpha
: Whenfill
option is used, we can set the transparency of filled boxes with this option that takes in an array (vec or 1-row matrix) with numeric values between [0-1] or ]1-100],
where 100 (or 1) means full transparency.
boxwidth
orcap
: Sets the the boxplot width and, optionally, the cap width. Provide info asboxwidth="10p/3p"
to set the boxwidth different from the cap's. Note, however, that this requires GMT6.5. Previous versions do not destinguish box and cap widths.groupWidth
: Specify the proportion of the x-axis interval across which each x-group of boxes should be spread. The default is 0.75.notch
: Logical value indicating whether the box should have a notch.outliers
: If other than a NamedTuple, plots outliers (1.5IQR) with the default black 5pt stars. If argument is a NamedTuple (marker=??, size=??, color=??, markeredge=??), wheremarker
is one of theplots
marker symbols, plots the outliers with those specifications. Any missing spec default to the above values. i.eoutliers=(size="3p")
plots black 3 pt stars.horizontal
orhbar
: plot horizontal instead of vertical boxplots.weights
: Array giving the weights for the data indata
. The array must be the same size asdata
.region
orlimits
: By default we estimate the plotting limits but sometimes that may not be convenient. Give a region=(xmin,xmax,ymin,ymax) tuple if you want to control the plotting limits.separator
: If = true plot a black line separating the groups. Otherwise provide the pen settings of those lines.ticks
orxticks
oryticks
: A tuple with annotations interval and labels. E.g. xticks=(1:5, ["a", "b", "c", "d"]) where first element is an AbstractArray and second an array or tuple of strings or symbols.
GMT.buffergeo
— Methodbuffergeo(D::GMTdataset; width=0, unit=:m, np=120, flatstart=false, flatend=false, epsg::Integer=0, tol=0.01)
or
buffergeo(line::Matrix; width=0, unit=:m, np=120, flatstart=false, flatend=false, proj::String="", epsg::Integer=0, tol=0.01)
or
buffergeo(fname::String; width=0, unit=:m, np=120, flatstart=false, flatend=false, proj::String="", epsg::Integer=0, tol=0.01)
Computes a buffer arround a poly-line. This calculation is performed on a ellipsoidal Earth (or other planet) using the GeographicLib (via PROJ4) so it should be very accurate.
Parameters
D
|line
| fname: - the geometry. This can either be a GMTdataset (or vector of it), a Mx2 matrix, the name of file that can be read as a GMTdataset bygmtread()
or a GDAL AbstractDataset objectwidth
: - the buffer width to be applied. Expressed meters (the default), km or Miles (seeunit
)unit
: - Ifwidth
is not in meters use one ofunit=:km
, orunit=:Nautical
orunit=:Miles
np
: - Number of points into which circles are descretized (Default = 120)flatstart
- When computing buffers arround poly-lines make the start flat (no half-circle)flatend
- Same asflatstart
but for the buffer endproj
- If line data is in Cartesians but with a known projection pass in a PROJ4 string to allow computing the bufferepsg
- Same asproj
but using an EPSG codetol
- At the end simplify the buffer line with a Douglas-Peucker procedure. Use TOL=0 to NOT do the line simplification, or use any other value in degrees. Default computes it as 0.5% of buffer width.
Returns
A GMT dataset or a vector of it (when input is Vector{GMTdataset})
Example: Compute a buffer with 50000 m width
D = buffergeo([0 0; 10 10; 15 20], width=50000);
GMT.burn_alpha!
— Methodburn_alpha!(img::GMTimage{<:UInt8, 3}, alpha; bg=:white)
Burn the alpha channel into the image by compositing the image values with the background color at locations where alpha is non-zero.
img
: The RGB image to be modified by the alpha channel.alpha
: A GMTimage or a matrix of uint8/boolean values indicating the locations where the corresponding locations in the image should be burned. All non-zero values will be used to composite the image with the background color. For example, a value of 255 will replace a pixel by the background color, a value of 127 will compose the image and background witha weight of 50% each.bg
: The background color to be used in the compositing. It can be a 3-tuple of integers in the range [0 255] or a symbol or string that will a color name. e.g.,bg=:blue
. The default is:white
.
GMT.cart2pol
— Methodtheta, rho = cart2pol(x, y; deg=false)
Transform Cartesian to polar coordinates. Angles are returned in radians by default. Use deg=true
to return the angles in degrees. Input can be scalar, vectors or matrices.
GMT.cart2sph
— Methodaz, elev, rho = cart2sph(x, y, z; deg=false)
Transform Cartesian coordinates to spherical. Angles are returned in radians by default. Use deg=true
to return the angles in degrees. Input can be scalar, vectors or matrices.
GMT.check_remote_cpt
— Methodcpt = check_remote_cpt(cmd0::String) -> String
Check if cmd0
is a remote grid or a OceanColor one and return the default CPT if it is.
GMT.circgeo
— Methodcircgeo(lon, lat; radius=X, proj="", s_srs="", epsg=0, dataset=false, unit=:m, np=120, shape="")
or
circgeo(lonlat; radius=X, proj="", s_srs="", epsg=0, dataset=false, unit=:m, np=120, shape="")
Args:
lonlat
: - longitude, latitude (degrees). If a Mx2 matrix, returns as many segments as number of rows. Use this to compute multiple shapes at different positions. In this case output type is
always a vector of GMTdatasets.
radius
: - The circle radius in meters (but seeunit
) or circumscribing circle for the other shapesproj
ors_srs
: - the given projection whose ellipsoid we move along. Can be a proj4 string or an WKTepsg
: - Alternative way of specifying the projection [Default is WGS84]dataset
: - If true returns a GMTdataset instead of matrix (with single shapes)unit
: - Ifradius
is not in meters use one ofunit=:km
, orunit=:Nautical
orunit=:Miles
np
: - Number of points into which the circle is descretized (Default = 120)shape
: - Optional string/symbol with "triangle", "square", "pentagon" or "hexagon" (or just the first char) to compute one of those geometries instead of a circle.np
is ignored in these cases.
Returns
- circ - A Mx2 matrix or GMTdataset with the circle coordinates
Example: Compute circle about the (0,0) point with a radius of 50 km
c = circgeo([0.,0], radius=50, unit=:k)
GMT.clip
— Methodclip(cmd0::String="", arg1=nothing; kwargs...)
Reads (length,azimuth) pairs from file and plot a windclip diagram.
See full GMT (not the GMT.jl
one) docs at psclip
Parameters
C | endclip :: [Type => Bool]
Mark end of existing clip path. No input file is needed.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
A | steps :: [Type => Str or []]
By default, geographic line segments are connected as great circle arcs. To connect them as straight lines, use A
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
Jz | zscale | zsize :: [Type => String]
N | invert :: [Type => Bool]
Invert the sense of the test, i.e., clip regions where there is data coverage.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
T | clipregion :: [Type => Bool]
Rather than read any input files, simply turn on clipping for the current map region.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? clip$
GMT.cmap2cpt
— MethodC = map2cpt(I::GMTimage) -> GMTcpt
Converts the I
colormap, which is a plain vector, into a GMTcpt.
GMT.coast
— Functioncoast(cmd0::String=""; kwargs...)
Plot continents, shorelines, rivers, and borders on maps. Plots grayshaded, colored, or textured land-masses [or water-masses] on maps and [optionally] draws coastlines, rivers, and political boundaries. A map projection must be supplied.
See full GMT (not the GMT.jl
one) docs at coast
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
A | area :: [Type => Str or Number]
Features with an area smaller than minarea in km^2 or of hierarchical level that is lower than minlevel or higher than max_level will not be plotted.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | river_fill :: [Type => Str]
Set the shade, color, or pattern for lakes and river-lakes.
D | res | resolution :: [Type => Str] $Arg = c|l|i|h|f|a$
Selects the resolution of the data set to use ((f)ull, (h)igh, (i)ntermediate, (l)ow, (c)rude), or (a)uto).
E | DCW :: [Type => Str]
Select painting or dumping country polygons from the Digital Chart of the World.
- Tuple("code", Str); Tuple(code, number); Tuple("code" [,"fill"], (pen)); Tuple((...),(...),...)
- ex: ("PT",(0.5,"red","–")); (("PT","gblue",(0.5,"red"),("ES",(0.5,"yellow")))
DCW=:PT; DCW=(:PT, 1); DCW=("PT", :red)
getR | getregion | get_region :: [Type => Str]
Return the region corresponding to the code/list-of-codes passed in as argument.
F | box :: [Type => Str]
Draws a rectangular border around the map scale or rose.
G | land :: [Type => Str]
Select filling or clipping of “dry” areas.
I | rivers :: [Type => Str]
Draw rivers. Specify the type of rivers and [optionally] append pen attributes.
L | map_scale :: [Type => Str]
Draw a map scale.
M | dump :: [Type => Str]
Dumps a single multisegment ASCII output. No plotting occurs.
N | borders :: [Type => Str]
Draw political boundaries. Specify the type of boundary and [optionally] append pen attributes
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
clip :: [Type => Str] $Arg = land|water|end$
To clip land do clip=:land, clip=:water clips water. Use end to mark end of existing clip path. No projection information is needed.
S | water | ocean :: [Type => Str]
Select filling or clipping of “wet” areas.
Td | rose` :: [Type => Str]
Draws a map directional rose on the map at the location defined by the reference and anchor points.
Tm | compass :: [Type => Str]
Draws a map magnetic rose on the map at the location defined by the reference and anchor points.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | shore | shorelines | coast | coastlines :: [Type => Str] Draw shorelines [Default is no shorelines]. Append pen attributes.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? coast$
GMT.coastlinesproj
— Methodcl = coastlinesproj(proj="?", res="crude", coastlines=nothing)
Extract the coastlines from GMT's GSHHG database and project them using PROJ (NOT the GMT projection machinery). This allows the use of many of the PROJ projections that are not available from pure GMT.
proj
: A proj4 string describing the projection (Mandatory).res
: The GSHHG coastline resolution. Available options are:crude
,low
,intermediate
,high
andfull
coastlines
: In alternative to theres
option, one may pass a GMTdataset with coastlines previously loaded (withgmtread
) from another source.limits
: If not empty it must be a 2 elements array with lonmin, lonmax that is used to ask for coastlines that expand more than 360 degrees (worldrectangular
uses this).
Returns
A Vector of GMTdataset containing the projected (or not) world GSHHG coastlines at resolution res
.
Example
cl = coastlinesproj(proj="+proj=ob_tran +o_proj=moll +o_lon_p=40 +o_lat_p=50 +lon_0=60");
GMT.colorbar
— Functioncolorbar(arg1=nothing; kwargs...)
Plots gray scales or color scales on maps.
See full GMT (not the GMT.jl
one) docs at psscale
D | pos | position :: [Type => Str]
Defines the reference point on the map for the color scale using one of four coordinate systems.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
F | box :: [Type => Str]
Draws a rectangular border around the scale.
G | truncate :: [Type => Str]
Truncate the incoming CPT so that the lowest and highest z-levels are to zlo and zhi.
I | shade :: [Type => Number | Str]
Add illumination effects.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
Jz | zscale | zsize :: [Type => String]
L | equal | equal_size :: [Type => Str | Bool]
Arg = [i][gap]
Gives equal-sized color rectangles. Default scales rectangles according to the z-range in the CPT.
M | monochrome :: [Type => Bool]
Force conversion to monochrome image using the (television) YIQ transformation.
N | dpi :: [Type => Str | Number]
Controls how the color scale is represented by the PostScript language.
Q | log :: [Type => Str]
Selects a logarithmic interpolation scheme [Default is linear].
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | appearance | nolines :: [Type => Bool | []]
Do not separate different color intervals with black grid lines.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | scale :: [Type => Number]
Multiply all z-values in the CPT by the provided scale.
Z | zfile :: [Type => Str]
File with colorbar-width per color entry.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? colorbar$
GMT.colorzones!
— Methodcolorzones!(shapes::Vector{GMTdataset}[, fun::Function]; img::GMTimage=nothing,
url::AbstractString="", layer=0, pixelsize::Int=0, append::Bool=true)
Paint the polygons in the shapes
with the average color that those polygons ocupy in the img
image. When the shapes
are plotted the resulting image looks like a choropleth map. Alternatively, instead of transmitting the img
image one can provide a WMS URL, layer
number and pixelsize
to download images from the Web Map Server service, covering each one the bounding box of each of the shapes
polygons. This option is much slower than passing the entire image at once but consumes much less memory. Important when the total area is large (think Russia size) because even at a moderately resultion it can imply downloading a huge file.
Parameters
shapes
: A vector of GMTdataset containing the polygons to be painted. This container will be changed in the sense that theheader
field of each polygon (a GMTdataset) will be appended with the fill color (but see also theappend
option that controls how this change takes place.)fun
: By default the average color is obtained by taking the square root of the average of squares of each of the three (RGB) bands (or just one for grayscale images). Give the name of another function to replace this default. For examplemedian
will assign the color by computing the median of each component inside the polygon area in question.img
: the image from which the stats (fun
) of each color for each polygon will be computed.url
: In case theimg
option is not used, pass the Web Map Server URL (see thewmsinfo
andwmsread
functions) from where the images covering the BoundingBox of each polygon will be downloaded. Warning, this is a much slower method but potentially useful when the images to download risk to be very big.layer
: When theurl
option is used this one becomes mandatory and represents the layer number or layer name of interest from those provided by the WMS service. That is, both forms are allowed:layer=3
orlayer="Invented layer name"
pixelsize
: Sets the requested cell size in meters [default]. Use a string appended with a 'd' (e.g.resolution="0.001d"
) if the resolution is given in degrees. This way works only when the layer is in geogs.append
: By default, the color assignment to each of the polygons in theshapes
vector is achieved by appending the fill color to the possibly existing header field. Running thecolorzones
command more than once keeps adding (now ignored, because only the first is used) colors. Settingappend=false
forces rewriting the header field at each run and hence the assigned color is always the one used (but the previous header is cleared out).
See also: rasterzones!
Returns
It does't return anything but the input shapes
is modified.
Example
Read the 2020 Sentinel2 Earth color for Portugal at 100 m resolution. Load the administrative
regions and compute their median colors.
wms = wmsinfo("http://tiles.maps.eox.at/wms?");
img = wmsread(wms, layer=3, region=(-9.6,-6,36.9,42.2), pixelsize=100);
Pt = gmtread("C:/programs/compa_libs/covid19pt/extra/mapas/concelhos/concelhos.shp");
colorzones!(Pt, median, img=img);
imshow(Pt, proj=:guess)
GMT.compacttype
— Methodcompacttype(T::Type, maxwidth::Int=8, initial::Bool=true)
Return compact string representation of type T
. For displaying data frame we do not want string representation of type to be longer than maxwidth
. This function implements rules how type names are cropped if they are longer than maxwidth
.
GMT.conf2geod
— Methodlat = conf2geod(latin, flat)
Convert conformal latitude latin
to geodetic latitude using the flattening of the ellipsoid.
Arguments
latin
: Conformal latitude(s) in radiansflat
: Flattening of ellipsoid (use 0.0 for is spherical)
Returns
lat
: Geodetic latitude(s) in radians
GMT.connect_rectangles
— Methodl1, l2 = connect_rectangles(R1, R2) -> Tuple{Matrix{Float64}, Matrix{Float64}}
Find the lines that connect two rectangles and do not intersect any of them (for zoom windows).
R1
andR2
are the [xmin, xmax, ymin, ymax] coordinates of the two rectangles:
Example:
R1 = [0.0, 3, 0, 2]; R2 = [5., 10, 5, 8];
l1, l2 = connect_rectangles(R1, R2)
GMT.contour
— Methodcontour(cmd0::String="", arg1=nothing; kwargs...)
Reads a table data and produces a raw contour plot by triangulation.
See full GMT (not the GMT.jl
one) docs at contour
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
A | annot | annotation :: [Type => Str | Number] $Arg = [-|[+]annot_int][labelinfo]$
annot_int is annotation interval in data units; it is ignored if contour levels are given in a file.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | cont | contour | contours | levels :: [Type => Str | Number | GMTcpt] $Arg = [+]cont_int$
Contours to be drawn may be specified in one of three possible ways.
D | dump :: [Type => Str]
Dump contours as data line segments; no plotting takes place.
E | index :: [Type => Str | Mx3 array]
Give name of file with network information. Each record must contain triplets of node numbers for a triangle.
G | labels :: [Type => Str]
Controls the placement of labels along the quoted lines.
I | fill | colorize :: [Type => Bool]
Color the triangles using the color scale provided via C.
Jz | zscale | zsize :: [Type => String]
L | mesh :: [Type => Str | Number]
Draw the underlying triangular mesh using the specified pen attributes (if not provided, use default pen)
N | no_clip :: [Type => Bool]
Do NOT clip contours or image at the boundaries [Default will clip to fit inside region].
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | cut :: [Type => Str | Number] $Arg = [cut[unit]][+z]]$
Do not draw contours with less than cut number of points.
S | skip :: [Type => Str | []] $Arg = [p|t]$
Skip all input xyz points that fall outside the region.
T | ticks :: [Type => Str] $Arg = [+|-][+a][+dgap[/length]][+l[labels]]$
Draw tick marks pointing in the downward direction every gap along the innermost closed contours.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | pen :: [Type => Str | Number]
Sets the attributes for the particular line.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
Z | scale :: [Type => Str]
Use to subtract shift from the data and multiply the results by factor before contouring starts.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
do | nodata_out :: [Type => Str or Number] $Arg = nodata$
Examine all output columns and if any item equals NAN substitute it with the chosen missing data value.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? contour$
GMT.contourf
— Functioncontourf(cmd0::String="", arg1=nothing; kwargs...)
Performs Delaunay triangulation on x,y[,z] data, i.e., it find how the points should be connected to give the most equilateral triangulation possible.
See full GMT (not the GMT.jl
one) docs at triangulate
Parameters
A | annot :: [Type => Str | Number] $Arg = [-|[+]annot_int][labelinfo]$
annot_int is annotation interval in data units; it is ignored if contour levels are given in a file.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | cont | contour | contours | levels :: [Type => Str | Number | GMTcpt] $Arg = [+]cont_int$
Contours to be drawn may be specified in one of three possible ways.
E | index :: [Type => Str | Mx3 array]
Give name of file with network information. Each record must contain triplets of node numbers for a triangle.
G | labels :: [Type => Str]
Controls the placement of labels along the quoted lines.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | cut :: [Type => Str | Number] $Arg = [cut[unit]][+z]]$
Do not draw contours with less than cut number of points.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | skip :: [Type => Str | []] $Arg = [p|t]$
Skip all input xyz points that fall outside the region (Used when input data is a table).
S | smooth :: [Type => Number]
Used to resample the contour lines at roughly every (gridbox_size/smoothfactor) interval. (Used when input data is a grid)
T | ticks :: [Type => Str] $Arg = [+|-][+a][+dgap[/length]][+l[labels]]$
Draw tick marks pointing in the downward direction every gap along the innermost closed contours.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | pen :: [Type => Str | Number]
Sets the attributes for the particular line.
Z | xyz | triplets :: [Type => Bool]
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
Examples
G = GMT.peaks();
C = makecpt(T=(-7,9,2));
contourf(G, show=1)
contourf(G, C=[-2, 0, 2, 5], show=1)
contourf(G, C, contour=[-2, 0, 2, 5], show=1)
contourf(G, C, annot=[-2, 0, 2, 5], show=1)
contourf(G, C, annot=2, show=1)
contourf(G, C, contour=1, annot=[-2, 0, 2, 5], show=1)
contourf(G, C, annot=:none, show=1)
d = [0 2 5; 1 4 5; 2 0.5 5; 3 3 9; 4 4.5 5; 4.2 1.2 5; 6 3 1; 8 1 5; 9 4.5 5];
contourf(d, limits=(-0.5,9.5,0,5), pen=0.25, labels=(line=(:min,:max),), show=1)
GMT.cornerplot
— Methodcornerplot(data; kwargs...)
Takes a nSamples-by-nDimensions array, and makes density plots of every combination of the dimensions. Plots as a triangular matrix of subplots showing the correlation among input variables. Input data
can be a MxN matrix, a GMTdataset
or a file name that upon reading with gmtread
returns a GMTdataset
.
The plot consists of histograms of each column along the diagonal and scatter or hexagonal bining plots for the inter-variable relations, depending on if the the number of samples is <= 1000. But this can be changed with options in kwargs
.
cornerplot(data)
: plots every 2D projection of a multidimensional data set.cornerplot(..., varnames)
: prints the names of each dimension.varnames
is a vector of strings of length nDimensions. If not provided, column names in theGMTdaset
are used.cornerplot(..., truths)
: indicates reference values on the plots.cornerplot(..., quantile)
: list of fractional quantiles to show on the 1-D histograms as vertical dashed lines.cornerplot(..., hexbin=true)
: Force hexbin plots even when number of points <= 1000.cornerplot(..., scatter=true)
: Force scatter plots even when number of points > 1000.cornerplot(..., histcolor|histfill=color)
: To paint diagonal histograms witha selected color (histcolor=:none to no paint).
Several more options in kwargs
can be used to control plot details (and are passed to the subplot
, binstats
and plot
functions.)
Example: cornerplot(randn(2500,3), cmap=:viridis, show=1)
GMT.count_chars
— Functioncount_chars(str::AbstractString, c::Char[=','])
Count the number of characters c
in the AbstracString str
GMT.countries_iso3to2
— Methodd = countries_iso3to2()
Return a dictionary with ISO 3166-1 Alpha-3 country codes as keys and ISO 3166-1 Alpha-2 country codes as values.
Example
d = countries_iso3to2();
d["AFG"]
"AF"
GMT.coupe
— Methodcoupe(cmd0::String="", arg1=nothing; kwargs...)
Plot cross-sections of focal mechanisms.
See full GMT (not the GMT.jl
one) docs at pscoupe
. Essentially the same as meca plus A. Run gmthelp(coupe)
to see the list of options.
GMT.cpt4dcw
— MethodC = cpt4dcw(codes::String, vals::Vector{<:Real}; kwargs...)
Create a categorical CPT to use with the output of coast(dcw=...)
to make Choropleth maps.
codes
is a comma separated string with two chars country codes (ex: "PT,ES,FR,IT")vals
a vector with same size as country codes, with the values used to colorize the countries
Optionally provide a CPT in the kwarg cmap=CPT
with a range sufficient to transform the vals
in colors. As an alternative to the above, provide a makecpt
type range
numeric vector to create a CPT. If none of these are provided a default CPT = makecpt(range=(0,255,1))
will be used.
GMT.crop
— Methodcrop(arg::GItype; kw...)
Crop a subregion of a grid (GMTgrid) or a image (GMTimage). The subregion is specified with the $limits$ or $region$ keyword; the specified range must not exceed the range of the input. This function differs from $grdcut$ in the sense that it doesn't call the GMT lib and works only on in-memory array (i.e., no disk files).
Returns
A grid or an image, depending on the input type, plus two 1x2 matrices with the indices of the cropped zone.
Example
G = GMT.peaks();
crop(G, region=(-2,2,-2,2))
GMT.cube
— FunctionFV = cube(r=1.0)
Creates a cube mesh with radius r
.
GMT.cubeplot
— Functioncubeplot(img1::Union{GMTimage, String}, img2::Union{GMTimage, String}="", img3::Union{GMTimage, String}="";
back::Bool=false, show=false, notop::Bool=false, xlabel="", ylabel="", zlabel="", title="", kw...)
Plot images on the sides of a cube. Those images can be provided as file names, or GMTimage objects.
img1,2,3
: File names or GMTimages of the images to be plotted on the three sides of a cube. Of those three, onlyimg1
is mandatory, case in which it will be repeated on the three visible sides of the cube. Ifimg1
andimg2
, the second image is plotted on the two vertical sides. When the three images are provided, the first goes to top (or bottom ifback=true
) the second to the xz and third to yz planes.back
: Boolean that defaults to false, meaning that images are printed on the front sides of the cube. Iffalse
, the images are printed in the back sides. Use this option when wanting to plot on the walls of a 3D lines/scatter or grid views. The default is to print on the front facades.notop
: If true, do not plot the top side (impliesback=false
)show
: Iftrue
, finish and display the figure.
The kw...
keyword/value options may be used to pass:
coast
: If true, plot a coastline basemap on the top or bottom side. Use $coast=(options..)$ to pass options to the coast module. This option can only be used with cubes of geographical coordinates.region, limits
: The limits extents that will be used to annotate the x,y,z axes. It uses the same syntax as all other modules that accept this option (e.g. $coast$). It defaults to "0/9/0/9/-9/0"figsize
: Select the horizontal size(s). Defaults to 15x15 cm.zsize
: Sets the size of z axis in cm. The default is 15.view
: The view point. Default is(135,30)
. WARNING: only azimute views from the 4rth quadrant are implemented.transparency
: Sets the image's transparency level in the [0,1] or [0 100] intervals. Default is opaque.inset
orhole
: Draws an inset hole in the cube's Southern wall. This option is a tuple with the form: $((img1,img2[,img3]), width=?, [depth=?])$ where $(img1,img2[,img3])$ are the images of thenorth
(that is, the plane whose normal isy
) andwest
(that is, the plane whose normal isx
) and, optionally,bottom
sides of the inset. Thewidth
anddepth
are the width and depth of the inset. Ifdepth
is not provided it defaults towidth
. These values must be given in percentage of the cube's width and can be given in the [0-1] or [0-100] interval.xlabel, ylabel, zlabel, title
: Optional axes labels and title. Each one of these must be a string.cmap, colormap, cpt, colorscale
: Add a colorbar at the bottom of the figure. The colormap can be passed as a single argument or as a tuple of arguments, where first must be the colormap and second [and optional a third] are the axes colorbar labels taking the form:cmap=(C, "xlabel=Blabla1"[, "ylabel=Blabla2"])
.
GMT.cubeplot
— Methodcubeplot(G::GMTgrid; top=nothing, topshade=false, zdown::Bool=false, xlabel="", ylabel="", zlabel="", title="",
show=false, interp::Float64=0.0, kw...)
Make a 3D plot of a 3D GMTgrid (a cube) with a top view perspective from the 4rth quadrant (only one implemented). There are several options to control the painting of the cube walls but off course not all possibilities are covered. For ultimate control, users can create the side wall images separately and feed them to the cubeplot method that accepts only images as input.
cmap, colormap, cpt, colorscale
: Pass in a GMTcpt colormap to be used to paint the vertical walls and optionally, the top wall. The default is to compute this from the cube's min/max values with theturbo
colormap.colorbar
: Add a colorbar at the bottom of the figure. The plotted colormap is either the auto-generated colormap (from the cube's min/max and theturbo
colormap) or the one passed via thecmap
option. The optional syntax of this option is either:colorbar=true
orcolorbar=(C, "xlabel=Blabla1"[, "ylabel=Blabla2"])
. Attention that when the labels request are passed, thy MUST conform with thexlabel=...
andylabel=...
prefix part.inset
: Add an inset to the figure. This inset takes the form of a hole located in the lower right corner of the cube in which its inner walls are painted with partial vertical slices of the cube. Theinset
option may be passed as a two elements array or tuple where first element is the starting longitude (end is cube's easternmost coordinate) and second the ending latitude (start is southernmost lat): an alternative syntax is to useinset=(lon=?, lat=?)
.interp
: When the cube layers are not equi-distant, the vertical side walls are not regular gris. This option, that is called by default, takes care of obtaining a regular grid by linear interpolation along the columns. This automatic interpolation uses the smallest increment in the vertical direction, but that may be overridden by theinterp
increment option (a float value).region, limits
: A 4 elements array or Tuple (x_min, x_max, y_min, y_max
) with the limits of a sub-region to display. Default uses the entire cube.show
: Iftrue
display the figure. Default isfalse
, i.e. it lets append further elements latter if wished.top
: An optional GMTgrid or the file name of a GMTgrid to be used to create the top wall of the cube. If, instead, a GMTimage is passed we plot it directly (grids are converted to images using default colormaps or one passed viatopcmap
). The default is to use the cube's first slice as the top wall.topshade
: Only used when thetop
option was used to pass a GMTgrid (or the name of one). Whentrue
, the top wall image is created with the cube's first slice and a shaded effect computed withgrdgradient
on thetop
grid (normally a topography grid). This creates a nice effect that shows both the cube's first layer and the topography where it lies. Optionally, thetopshade
option may be used with agrdgradient
grid computed with any other grid.topcmap
: An alternative colormap for the top wall. Default is the same as theturbo
computed with cubeG
itself.xlabel, ylabel, zlabel, title
: Optional axes labels and title. Each one of these must be a string.zdown
: Whentrue
, the z-axis is positive down. Default isfalse
(positive up).zsize
: Vertical size of the plotted cube. Default is 6 cm. Use a negative value if the z-axis is positive down, but see also the alternativezdown
option.
Example:
C = xyzw2cube("USTClitho2.0.wrst.sea_level.txt");
cubeplot(C, top="@earth_relief", inset=(lon=110,y=40), topshade=true, zdown=true, title="Vp model",
colorbar=("xlabel=P-wave velocity","ylabel=km/s"), show=true)
GMT.date2doy
— Methoddate2doy(date) -> Integer
Compute the Day-Of-Year (DOY) from date
that can be a string or a Date/DateTime type. If ommited, returns today's DOY
GMT.delrows!
— Methoddelrows!(A::Matrix, rows::VecOrMat)
Delete the rows of Matrix A
listed in the vector rows
GMT.density
— MethodD = density(x::Vector{<:Real}; nbins::Integer=200, bins::Vector{<:Real}=Vector{Real}(),
bandwidth=nothing, kernel::StrSymb="normal")
x
: calculate the kernel density 'd' of a dataset X for query points 'xd' The density, by default, is estimated using a gaussian kernel with a width obtained with the Silverman's rule.x
may be a vector, a matrix or Vector{Vector{Real}}.nbins
: points are queried between MIN(Y[:]) and MAX(Y[:]) where Y is the data vector.bins
: Calculates the density for the query points specified by BINS. The values are used as the query points directly. Default is 200 points.bandwidth
: uses the 'bandwidth' to calculate the kernel density. It must be a scalar. For the uniform case the bandwidth is set to 15% of the range, otherwise the bandwidth is chosen with the Silverman's rule.printbw
: Logical value indicating to print the computed value of thebandwidth
.kernel
: Uses the kernel function specified by KERNEL name (a string or a symbol) to calculate the density. The kernel may be: 'Normal' (default) or 'Uniform'extend
: By default the density curve is computed at thebins
locatins or between data extrema as mentioned above. However, this is not normally enough to go down to zero. Use this option in terms of number of bandwidth to expand de curve. e.g.extend=2
The version G = density(data, x,y; weights=nothing, bandwidth=nothing, showbw=false)
Computes the smoothed kernel probability density estimate of a two-column matrix data
. The estimate is based on a normal kernel function, and is evaluated at the points defined by the vectors x
and y
. The showbw
option is used to print the bandwidth used. It returns a GMTgrid of the same size as x
and y
.
Example
X = [0.5*rand(20,1) 5 .+ 2.5*rand(20,1); .75 .+ 0.25*rand(10,1) 8.75 .+ 1.25*rand(10,1)]
G = density(X, -0.25:.05:1.25, 0:.1:15)[1];
viz(G, figsize=(12,12), view=(225,30))
GMT.df2ds
— MethodD = df2ds(df)
Extract numeric data from a DataFrame type and return it into a GMTdataset. Works only with 'simple' DataFrames.
GMT.dilate_mask
— Methoddilate_mask(mask, ngrow)
Takes a mask and dilates each false
with ngrow
false
s on either side. This is equivalent to boolean "convolution".
GMT.dims
— Methodheight (nrows), width (ncols) = dims(GI::GItype)
Return the width and height of the grid/cube or image. The difference from size
is that the when the memory layout is 'rows' the array is transposed and we get the wrong info. Here, we use the sizes of the 'x,y' coordinate vectors to determine the array's true shape.
GMT.dodecahedron
— FunctionFV = dodecahedron(r=1.0)
Creates an dodecahedron mesh with radius r
.
GMT.doy2date
— Functiondoy2date(doy[, year]) -> Date
Compute the date from the Day-Of-Year doy
. If year
is ommited we take it to mean the current year. Both doy
and year
can be strings or integers.
GMT.dsget_segment_ids
— Methodids, ind = dsget_segment_ids(D)::Tuple{Vector{String}, Vector{Int}}
Where D is a GMTdataset or a vector of them, returns the segment ids (first text after the '>') and the indices of those segments.
GMT.earthregions
— Function[GI = ] earthregions(name=""; proj="guess", country=false, dataset="", grid=false,
res="", registration="", round=0, exact=false)
earthregions
plots or automatically extracts grid/image over a named geographic region. A large number of predefined regions is provided via collections, which are lists of names, their rectangular geographic boundaries and a code to access them. Users pick a region by its code(s) and choose between making a map of that region or download topo/bathymetric data (a grid or image) of that area.
Parameters
name
: It can be either the name of one collection or the code of one geographic region. If it is a collection name (one of: $"DCW", "NatEarth", "UN", "Mainlands", "IHO", "Wiki", "Lakes"$) the regions of that collection are printed, displaying the region's boundaries, code and name. If, instead, a code is passed (codes are unique) then depending on the values ofgrid
ordataset
we either produce a map of that region (the default) or extract grid/image over it.proj
: In case a map is requested, pass the desired projection in form of a proj4 string or use the GMT projection syntax for that map. By default, we guess a good projection based on the map limits.country
: The particular case of the $DCW$ collection let us also plot the country(ies) border lines. Setcountry=true
to do that. Note that the $DCW$ regions can be specified by a comma separated list of country codes, e.g.earthregions("PT,ES", country=true)
.dataset
: This option is used to select data download instead of map plotting. The available datasets are those explained in https://www.generic-mapping-tools.org/remote-datasets/, which shortly are: $"earth_relief", "earth_synbath", "earth_gebco", "earth_mask", "earth_day", "earth_night", "earth_geoid", "earth_faa", "earth_mask", "eart_dist", "earth_mss", "earth_vgg", "earth_wdmam", "earth_age", "mars_relief", "moon_relief", "mercury_relief", "venus_relief", "pluto_relief"$.Note that $"earth_day", "earth_night"$ are images that are not stored as tilles in the server, so the entire file is downloaded (only once and stored in your local ~.gmt/server directory). So, this may take a while for the first-time usage.
grid
: A shorthand boolean option equivalent todataset="earth_relief"
res
: The dataset resolution. Possible resolutions are: $"01d", "30m", "20m", "15m", "10m", "06m", "05m", "04m", "03m", "02m", "01m", "30s", "15s", "03s", "01s"$. However, they are not all available to all datasets. For example, only $"earth_relief", "earth_synbath", "earth_gebco"$ exist for all those resolutions. In case adataset
is specified but no resolution, we make estimate of that resolution based on map extents and what would be good to create a map with 15 cm width.registration
: The dataset registration. Eithergrid
orpixel
. If not provided we choose one.exact
: The region boundaries in the collections were rounded to more friendly numbers (few decimals). This means that they differ slightly from the pure $GMT$ (coast
) numbers. Settingexact=true
will force using the strict $GMT$ limits.round=inc
: Adjust the region boundaries by rounding to multiples of the steps indicated by inc, (xinc,yinc), or (winc,einc,sinc,ninc). Aditionally,round
can be a string but in that case it must strictly follow the hard core GMT syntax explained at https://docs.generic-mapping-tools.org/dev/coast.html#r
See also: coast
, mosaic
Returns
A $GMTgrid$ or a $GMTimage$ if dataset
is used or $nothing$ otherwise.
Examples
earthregions("IHO") # List the ocean regions as named by the IHO
earthregions("PT,ES,FR", country=true) # Make a map of Portugal, Spain and France regions.
G = earthregions("IHO31", grid=true); # Get a grid of the "Sea of Azov"
viz(G, shade=true, coast=true) # and make a nice map.
To see the plots produced by these examples type: $@? earthregions$
GMT.earthtide
— Functionearthtide(cmd0::String=""; kwargs...)
Compute grids or time-series of solid Earth tides.
See full GMT (not the GMT.jl
one) docs at earthtide
G = earthtide();
imshow(G)
GMT.ecdfplot
— Methodecdfplot(x::AbstractVector{<:Real}; kwargs...)
Plot the empirical cumulative distribution function (ECDF) of x
. The kwargs
may contain any option used in the plot
module.
Example: ecdfplot(randn(100), show=true)
GMT.epsg2proj
— Methodepsg2proj(code::Integer)
Convert a EPSG code into the PROJ4 form.
GMT.epsg2wkt
— Methodepsg2wkt(code::Integer, pretty::Bool=false)
Convert a EPSG code into the WKT form. Use pretty=true
to return a more human readable text.
GMT.extrema_cols
— Methodextrema_cols(A; col=1)
Compute the minimum and maximum of a column of a matrix/vector A
ignoring NaNs
GMT.facenorm
— Methodn = facenorm(M::Matrix{<:Real}; normalize=true)
Calculates the normal vector of a polygon with vertices in M
.
normalize
: By default, it returns the unit vector. Iffalse
, it returns the non-normalized vector that represents the area of the polygon.
Returns
A 3 elements vector with the components of the normal vector.
GMT.feather
— Functionfeather(cmd0::String="", arg1=nothing; arrow=(...), kwargs...)
GMT.fill_between
— Methodfill_between(D1 [,D2]; kwargs...)
Fill the area between two horizontal curves.
The curves are defined by the points (x, y1, y2) in matrix or GMTdataset D1
. This creates one or multiple polygons describing the filled area. Alternatively, give a second matrix, D2
(or a scalar y=cte) and the polygons are constructed from the intersections of curves D1
and D2
.
fill_between(..., fill=colors)
: Give a list with two colors to paint the 'up' and 'down' polygons.fill_between(..., fillalpha=[alpha1,alpha2])
: Sets the transparency of the two sets of polygons (default 60%).fill_between(..., pen=...)
: Sets pen specifications for the two curves. Easiest is to use the shortcutslt
,lc
andls
for the line thickness, color and style like it is used in theplot()
module.fill_between(..., stairs=true)
: Plot stairs curves instead.fill_between(..., markers=true)
: Add marker points at the data locations.fill_between(..., white=true)
: Draw a thin white border between the curves and the fills.fill_between(..., labels=...)
: Pass labels to use in a legend.labels=true
wil use the column names inD1
andD2
.labels="Lab1,Lab2"
orlabels=["Lab1","Lab2"]
(this one can be a Tuple too) use the text inLab1
,Lab2
.
fill_between(..., legend=...)
: If used as the abovelabels
it behaves like wise, but its argument can also be a named tuple withlegend=(labels="Lab1,Lab2", position=poscode, box=(...))
.
Example:
theta = linspace(-2π, 2π, 150);
y1 = sin.(theta) ./ theta;
y2 = sin.(2*theta) ./ theta;
fill_between([theta y1], [theta y2], white=true, legend="Sinc1,Sinc2", show=1)
GMT.filter1d
— Methodfilter1d(cmd0::String="", arg1=nothing, kwargs...)
Time domain filtering of 1-D data tables.
See full GMT (not the GMT.jl
one) docs at filter1d
Parameters
F | filter :: [Type => Str]
Arg = type width[modifiers]
Sets the filter type. Choose among convolution and non-convolution filters. Append the filter code followed by the full filter width in same units as time column.
D | inc | increment :: [Type => Number]
Arg = increment
$increment$ is used when series is NOT equidistantly sampled. Then increment will be the abscissae resolution.
E | end | ends :: [Type => Bool | []]
Include Ends of time series in output. Default loses half the filter-width of data at each end.
L | gap_width :: [Type => Number | Str]
Arg = width
Checks for Lack of data condition. If input data has a gap exceeding width then no output will be given at that point.
N | time_col | timecol :: [Type => Int]
Arg = t_col
Indicates which column contains the independent variable (time). The left-most column is # 0, the right-most is # (n_cols - 1). [Default is 0].
Q | quality :: [Type => Number]
Arg = q_factor
Assess Quality of output value by checking mean weight in convolution. Enter q_factor between 0 and 1.
S | symmetry :: [Type => Number]
Arg = symmetry_factor
Checks symmetry of data about window center. Enter a factor between 0 and 1.
T | range | inc :: [Type => List | Str]
Arg = [min/max/]inc[+a|n]
Make evenly spaced time-steps from min to max by inc [Default uses input times].
cumdist
|cumsum
: [Type => Bool]Compute the cumulative distance along the input line. Note that for this the first two columns must contain the spatial coordinates.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.fit_line
— Methodfit_line(x, y)
Simple linear regression, returns (intercept, slope)
. https://en.wikipedia.org/wiki/Simplelinearregression
GMT.fitcircle
— Methodfitcircle(cmd0::String="", arg1=nothing, kwargs...)
Find mean position and great [or small] circle fit to points on a sphere.
See full GMT (not the GMT.jl
one) docs at fitcircle
Parameters
L | norm :: [Type => Int | []]
Specify the desired norm as 1 or 2, or use [] or 3 to see both solutions.
F | coord | coordinates :: [Type => Str]
Arg = f|m|n|s|c
Only return data coordinates, and append Arg to specify which coordinates you would like.
S | small_circle :: [Type => Number]
Arg = symmetry_factor
Attempt to
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.floating_window
— Methodcode = floating_window(fig_W, fig_H, float_W, float_H, lims_zoom) -> String
Given the size of the figure, the size of the inset and the zoom limits, compute the anchor location of the inset such that it doesn't overlap with the zoom window. All inputs are in paper units.
It works like this: The figure window is divided in a 3x3 cells matrix. We compute in which cell falls the center of the zoom window. Next, we try to place the inset either above or below the zoom window. The rational for this is that if those positions are good it si almost sure that the inset will not overlap the data being displayed. If it doesn't fit, we try the next position to the right along the top or bottom rows of the 3x3 matrix. In each test, we always check if zoom and inset windows overlap.
fig_W
andfig_H
are the size of the figure in paper units:float_W
andfloat_H
are the size of the inset in paper units:lims_zoom
: is a vector of 4 numbers: [xmin xmax ymin ymax] in paper units with limits of the zoom window.
GMT.flower_minho
— MethodGMT.gadm
— Methodgadm(country, subregions...; children=false, names=false, children_raw=false, reportlevels=false)
Returns a GMTdataset for the requested country, or country subregion(s)
country
: ISO 3166 Alpha 3 country code .subregions
: Full official names in hierarchial order (provinces, districts, etc...). To know the names of all administrative children of parent, use the optionnames
.children
: When true, function returns all subregions of parent.children_raw
: When true, function returns two variables -> parent, children, where children is a GDAL object E.g. when children is set to true and when querying just the country, second return parameter are the states/provinces. Ifchildren
we return a Vector of GMTdataset with the polygons. Ifchildren_raw
the second output is a GDAL object much like in GADM.jl (less the Tables.jl)names
: Return a string vector with allchildren
names.reportlevels
: just report the number of administrative levels (including the country) and exit.
Examples
# data of India's borders
data = gadm("IND")
# uttar -> the limits of the Uttar Pradesh state
uttar = gadm("IND", "Uttar Pradesh")
# uttar -> limits of all districts of the Uttar Pradesh state
uttar = gadm("IND", "Uttar Pradesh", children=true)
# Names of all states of India
gadm("IND", names=true)
GMT.gammacorrection
— Methodgammacorrection(I::GMTimage, gamma; contrast=[0.0, 1.0], brightness=[0.0, 1.0])
Apply a gamma correction to a 2D (intensity) GMTimage using the exponent gamma
. Optionally set also contrast
and/or brightness
Returns
A GMT intensity Image
GMT.gd2gmt
— MethodO = gd2gmt(dataset; band=0, bands=[], sds=0, pad=0)
Convert a GDAL raster dataset into either a GMTgrid (if type is Int16 or Float) or a GMTimage type Use band
to select a single band of the dataset. When you know that the dataset contains several bands of an image, use the kwarg bands
with a vector the wished bands. By default it reads all bands of the image or grid object.
When DATASET is a string it may contain the file name or the name of a subdataset. In former case you can use the kwarg sds
to selec the subdataset numerically. Alternatively, provide the full sds
name. For files with sds
with a scale_factor (e.g. MODIS data), that scale is applyied automaticaly.
Examples:
G = gd2gmt("AQUA_MODIS.20210228.L3m.DAY.NSST.sst.4km.NRT.nc", sds=1);
or
G = gd2gmt("SUBDATASET1NAME=NETCDF:AQUA_MODIS.20210228.L3m.DAY.NSST.sst.4km.NRT.nc:sst");
or
G = gd2gmt("NETCDF:AQUA_MODIS.20210228.L3m.DAY.NSST.sst.4km.NRT.nc:sst");
GMT.gdaldrivers
— Functiongdaldrivers(type="raster"; out::Bool=false)
List all the GDAL drivers available in this GMT.jl installation. By default it prints the names of the raster drivers, but if type="vector"
it will print the names of the vector drivers. If out=true
, instead of printing a table it will return the four columns of the table in separate 4 vectors.
GMT.gdalread
— Functiongdalread(fname::AbstractString, opts=String[]; gdataset=false, kwargs...)
Read a raster or a vector file from a disk file and return the result either as a GMT type (the default) or a GDAL dataset.
fname
: Input data. It can be a file name, a GMTgrid or GMTimage object or a GDAL datasetopts
: List of options. The accepted options are the ones of the gdal_translate utility. This list can be in the form of a vector of strings, or joined in a simgle string.gdataset
: If set totrue
forces the return of a GDAL dataset instead of a GMT type.kwargs
: This options accept the GMT region (-R) and increment (-I)
Returns
A GMT grid/image or a GDAL dataset
GMT.gdalshade
— Methodgdalshade(filename; kwargs...)
Create a shaded relief with the GDAL method (color image blended with shaded intensity).
- kwargs hold the keyword=value to pass the arguments to
gdaldem hillshade
Example: I = gdalshade("hawaii_south.grd", C="faa.cpt", zfactor=4);
Returns
A GMT RGB Image
GMT.gdalwrite
— Functiongdalwrite(fname::AbstractString, data, opts=String[]; kwargs...)
Write a raster or a vector file to disk
fname
: Output file name. If not explicitly selected viaopts
the used driver will be picked from the file extension.data
: The data to be saved in file. It can be a GMT type or a GDAL dataset.opts
: List of options. The accepted options are the ones of the gdal_translate or ogr2ogr utility. This list can be in the form of a vector of strings, or joined in a simgle string.kwargs
: This options accept the GMT region (-R) and increment (-I)
or
gdalwrite(cube::GItype, fname::AbstractString, v=nothing; dim_name::String="time", dim_units::String="")
Write a MxNxP cube
object to disk as a multilayered file.
cube
: A GMTgrid or GMTimage cubefname
: The file name where to save thecube
v
: A vector with the coordinates of the Z layers (if omitted create one as 1:size(cube,3))dim_name
: The name of the variable of the $vertical$ dimension.dim_units
: The units of thev
vector. If not provided, use thecube.z_units
if exist (GMTgrid only)
GMT.geocoder
— MethodD = geocoder(address::String; options=String[]) => GMTdataset
Get the geocoder info for a given address by calling the GDAL/OGR geocoding functions. See https://gdal.org/doxygen/ogr__geocoding_8h.html
Arguments
address
: The string to geocode.options
: These are the options passed to GDAL and in the form of a vector of strings. For example, the default is equivalent tooptions=["SERVICE", "OSM_NOMINATIM"]
.- "CACHE_FILE" : Defaults to "ogr_geocode_cache.sqlite" (or otherwise "ogr_geocode_cache.csv" if the SQLite driver isn't available). Might be any CSV, SQLite or PostgreSQL datasource.
- "READ_CACHE" : "TRUE" (default) or "FALSE"
- "WRITE_CACHE" : "TRUE" (default) or "FALSE"
- "SERVICE": "OSM_NOMINATIM" (default), "MAPQUEST_NOMINATIM", "YAHOO", "GEONAMES", "BING" or other value. Note: "YAHOO" is no longer available as a free service.
- "EMAIL": used by OSM_NOMINATIM. Optional, but recommended.
- "USERNAME": used by GEONAMES. Compulsory in that case.
- "KEY": used by BING. Compulsory in that case.
- "APPLICATION": used to set the User-Agent MIME header. Defaults to GDAL/OGR version string.
- "LANGUAGE": used to set the Accept-Language MIME header. Preferred language order for showing search results.
- "DELAY": minimum delay, in second, between 2 consecutive queries. Defaults to 1.0.
- "QUERY_TEMPLATE": URL template for GET requests. Must contain one and only one occurrence of %s in it. If not specified, for SERVICE=OSM_NOMINATIM, MAPQUEST_NOMINATIM, YAHOO, GEONAMES or BING, the URL template is hard-coded.
- "REVERSE_QUERY_TEMPLATE": URL template for GET requests for reverse geocoding. Must contain one and only one occurrence of {lon} and {lat} in it. If not specified, for SERVICE=OSM_NOMINATIM, MAPQUEST_NOMINATIM, YAHOO, GEONAMES or BING, the URL template is hard-coded.
Returns
A GMTdataset with the longitude, latitude, and full attribute dictionary returned by the geocoder for the input address. This dataset contains only one point but geocoding service resturns also a BoundingBox containing that point. When the address
is very specific that BB is tiny arround the point, but when the query is general (for example,just the name of a city or even a country), the BB is large and may be very useful to use in the mosaic
program. For that purpose, the returned BB is sored in the GMTdatset $ds_bbox$ field.
Example
geocoder("Paris, France")
GMT.geod
— Methoddest, azim = geod(lonlat, azim, distance; proj::String="", s_srs::String="", epsg::Integer=0, dataset=false, unit=:m)
Solve the direct geodesic problem.
Args:
lonlat
: - longitude, latitude (degrees). This can be a vector or a matrix with one row only.azimuth
: - azimuth (degrees) ∈ [-540, 540)distance
: - distance to move from (lat,lon); can be vector and can be negative, Default is meters but seeunit
proj
ors_srs
: - the given projection whose ellipsoid we move along. Can be a proj4 string or an WKTepsg
: - Alternative way of specifying the projection [Default is WGS84]dataset
: - If true returns a GMTdataset instead of matrixunit
: - Ifdistance
is not in meters use one ofunit=:km
, orunit=:Nautical
orunit=:Miles
The distance
argument can be a scalar, a Vector, a Vector{Vector} or an AbstractRange. The azimuth
can be a scalar or a Vector.
When azimuth
is a Vector we always return a GMTdataset with the multiple lines. Use this together with a non-scalar distance
to get lines with multiple points along the line. The number of points along line does not need to be the same. For data, give the distance
as a Vector{Vector} where each element of distance
is a vector with the distances of the points along a line. In this case the number of distance
elements must be equal to the number of azimuth
.
Returns
- dest - destination after moving for [distance] metres in [azimuth] direction.
- azi - forward azimuth (degrees) at destination [dest].
Example: Compute two lines starting at (0,0) with lengths 111100 & 50000, heading at 15 and 45 degrees.
dest, = geod([0., 0], [15., 45], [[0, 10000, 50000, 111100.], [0., 50000]])[1]
GMT.geod2cnf
— Methodlatconf = geod2cnf(latin, flat)
Convert geodetic latitudes latin
to conformal latitudes using the flattening flat
of the ellipsoid.
Arguments
latin
: Geodetic latitude(s) in radiansflat
: Flattening of the ellipsoid (Use 0.0 for is spherical)
Returns
- Conformal latitude(s) in radians.
GMT.geod2isometric
— Methodlat = geod2isometric(latin, flat)
Convert geodetic latitudes to isometric latitudes.
Arguments
latin
: Geodetic latitude(s) in degreesflat
: Flattening of the ellipsoid (Use 0.0 for is spherical)
Returns
- Isometric latitude in degrees
GMT.geodesic
— Methodfunction geodesic(D; step=0, unit=:m, np=0, proj::String="", epsg::Integer=0, longest::Bool=false)
or
function geodesic(lon1, lat1, lon2, lat2; step=0, unit=:m, np=0, proj::String="", epsg::Integer=0, longest::Bool=false)
Generate geodesic line(s) (shortest distace) on an ellipsoid. Input data can be two or more points. In later case each line segment is descretized at step
increments,
Parameters
D
: - the input points. This can either be a GMTdataset (or vector of it), a Mx2 matrix, the name of file that can be read as a GMTdataset bygmtread()
or a GDAL AbstractDataset objectstep
: - Incremental distance at which the segment line is descretized in meters(the default), but seeunit
unit
: - Ifstep
is not in meters use one ofunit=:km
, orunit=:Nautical
orunit=:Miles
np
: - Number of intermediate points between poly-line vertices (alternative tostep
)proj
- If line data is in Cartesians but with a known projection pass in a PROJ4 stringepsg
- Same asproj
but using an EPSG codelongest
- Compute the 'long way around' of the geodesic. That is, going from point A to B taking the longest path. But mind you that geodesics other than meridians and equator are not closed paths (see https://en.wikipedia.org/wiki/Geodesicsonanellipsoid). This line is obtained by computing the azimuth from A to B, at B, and start the line at B with that azimuth and go around the Earth till we reach, _close to A, but not exactly A (except for the simple meridian cases).
Returns
A Mx2 matrix with the lon lat of the points along the geodesic when input is a matrix. A GMT dataset or a vector of it (when input is Vector{GMTdataset}).
Example: Compute an geodesic between points (0,0) and (30,50) discretized at 100 km steps.
mat = geodesic([0 0; 30 50], step=100, unit=:k);
GMT.geodetic2enu
— MethodxEast, yNorth, zUp = geodetic2enu(lon, lat, h, lon0, lat0, h0)
Convert from geodetic coordinates to local East, North, Up (ENU) coordinates.
GMT.geog2merc
— Methodx, y = geog2merc(lon, lat, pt_radius)
Convert from mercator to geographic coordinates in degrees. For a sphere, lat
should be the geocentric latitude(s), but for an ellipsoid lat
should contain the isometric latitude(s).
Returns
- x,y Mercator coordinates in meters.
GMT.geosphere
— FunctionFV = geosphere(n, r=1; radius=1.0)
Generate a geodesic sphere triangulation based on the number of refinement iterations n
and the radius r
. Geodesic spheres (aka Buckminster-Fuller spheres) are triangulations of a sphere that have near uniform edge lenghts. The algorithm starts with a regular icosahedron. Next this icosahedron is refined n
times, while nodes are pushed to a sphere surface with radius r
at each iteration.
radius
: the keywordradius
is an alternative to the positional argumentr
.n
: is the number of times of iterations used to obtain the sphere from the icosahedron.
Returns
A two elements vector of GMTdataset where first contains the vertices and the second the indices that define the faces.
GMT.get_cube_layers_desc
— Functiondesc = get_cube_layers_desc(fname::String, layers::Vector{Int}=Int[]) -> Vector{String}
fname
: The name of a disk file of a cube.layers
: Only used when called from $find_layers()$ in $RemoteS$
GMT.get_geoglimits
— MethodWESN = get_geoglimits(GI::GItype)::Vector{Float64}
Get the geographical limits of grids or images and return them in a [West, East, South, North] vector. If grid/image is not referenced, returns an empty vector.
GMT.get_pocket_call
— Methodval get_pocket_call() -> Any
Pop the contents of the first non-empty slot in the pocket_call vector stack
GMT.getbb
— Methodbb = getbb(D::GDtype) -> Vector{Float64}
Get the bounding box of a dataset (or vector of them). Note: the returned data is based on information in D
metadata, not in rescanning the actual data.
GMT.getbyattrib
— Methodgetbyattrib(D::Vector{<:GMTdataset}[, index::Bool=false]; kw...)
or
filter(D::Vector{<:GMTdataset}; kw...)
or
findall(D::Vector{<:GMTdataset}; kw...)
Take a GMTdataset vector and return only its elements that match the condition(s) set by the kw
keywords. Note, this assumes that D
has its attrib
fields set with usable information.
NOTE: Instead of $getbyattrib$ one case use instead $filter$ (...,index=false
) or $findall$ (..., index=true
)
Parameters
attrib name(s)=value(s)
: Easier to explain by examples:NAME="Antioquia"
, select all elements that have that attribute/value combination.NAME=("Antioquia", "Caldas"), pick elements that have those
NAMEattributes. Add as many as wished. If using two
kwargsthe second works as a condition.
(..., NAME=("Antioquia", "Caldas"), feature_id=0)
means select all elements from
Antioquia
and
Caldas
that have the attribute
feature_id` = 0.invert, or reverse, or not
: Iftrue
return all segments that do NOT match the query condition(s).attrib
oratt
: (OLD SYNTAX) A NamedTuple with the attribname, attribvalue as inatt=(NAME_2="value",)
. Use more elements if wishing to do a composite match. E.g.att=(NAME_1="val1", NAME_2="val2")
in which case only segments matching the two conditions are returned.index
: Use thispositional
argument =true
to return only the segment indices that match theatt
condition(s).
Returns
Either a vector of GMTdataset, or a vector of Int with the indices of the segments that match the query condition. Or nothing
if the query results in an empty GMTdataset
Example:
D = filter(D, NAME_2="Porto");
GMT.getdecimal
— MethodReturn the decimal part of a float number x
GMT.getprovider
— Methodgetprovider(name, zoom::Int; variant="", date::String="", key::String="")
Get information about a tile provider given its name and zoom level. The returned information is only relevant for internal use and is an implementation detail not documented here.
Arguments
name
: Name of the tile provider. Currently available are "Bing" (the default), "Google", "OSM", "Esri", "Nimbo". Optionally, thename
can be a tuple of two strings, where the first string is the provider name and the second string is the variant name (see thevariant
bellow).The
name
argument can also be aProvider
type from the TileProviders.jl package. For example, after importing TileProviders.jl, $provider = NASAGIBSTimeseries()$ and next pass it togetprovider
.date
: Currently only used with the 'Nimbo' provider. Pass date in 'YYYY_MM' or 'YYYY,MM' format.key
: Currently only used with the 'Nimbo' provider. Pass your https://nimbo.earth/ API key.zoom
: Requested zoom level. Will be capped at the provider's maximum.variant
: Optional variant for providers with multiple map layers.Bing
: variants => "Aerial" (default), "Road", or "Hybrid".Google
: variants => "Satellite", "Road", "Terrain", or "Hybrid".Esri
: variants => "World_Street_Map" (default), "Elevation/World_Hillshade", or "World_Imagery".Nimbo
: variants => "RGB" (default), "NIR", "NDVI", or "RADAR".
GMT.getregion
— Methodx_min, x_max, y_min, y_max, x_inc_or_z_min, y_inc_or_z_max = getregion(dataset; gridreg=false, sds=0, GMT=false)
Inquire the region extents of a file or GMTgrid, GMTimage, GMTdataset or GDAL dataset.
Options gridreg
and sds
are only for GDAL datasets. When input
is a string (a file name) the default is to use GDAL and the region comes in 'pixel registration' by default. Use gridreg=true
to force 'grid registration'. Still for input
as string, use GMT=true
to force the result to be given by grdinfo
. An unfortunate consequence of using either GMT or GDAL to inquire a file/object is that the 5th and 6th outputs (only 4 when input
is a GMTdataset) have different contents. It will be either x_inc, y_inc
when reading with GDAL, and z_min, z_max
when reading with GMT.
GMT.getsize
— Methodwidth, height = getsize(GI::GItype) -> Tuple(Int, Int)
Return the width and height of the grid or image. The grid case is simple but images are more complicated due to the memory layout. To disambiguate this, we are not relying in 'size(GI)' but on the length of the x,y coordinates vectors, that are assumed to always be correct.
GMT.gmt
— MethodCall a GMT module. This function is not called directly by the users, except when using the $monolithic$ mode. Usage:
gmt("module_name `options`", args...)
GMT.gmt2gd
— Methodds = gmt2gd(GI)
Create GDAL dataset from the contents of GI that can be either a Grid or an Image
ds = gmt2gd(D, save="", geometry="")
Create GDAL dataset from the contents of D, which can be a GMTdataset, a vector of GMTdataset ir a MxN array. The save
keyword instructs GDAL to save the contents as an OGR file. Format is determined by file estension. geometry
can be a string with "polygon", where file will be converted to polygon/multipolygon depending on D
is a single or a multi-segment object, or "point" to convert to a multipoint geometry.
GMT.gmt2kml
— Methodgmt2kml(cmd0::String="", arg1=nothing, kwargs...)
Convert GMT data tables to KML files for Google Earth
See full GMT (not the `GMT.jl` one) docs at [`gmt2kml`](http://docs.generic-mapping-tools.org/latest/gmt2kml.html)
Parameters
A | altitude_mode :: [Type => Str] $Arg = a|g|s[alt|xscale]$
Select one of three altitude modes recognized by Google Earth that determines the altitude (in m) of the feature: $a$ absolute altitude, $g$ altitude relative to sea surface or ground, $s$ altitude relative to seafloor or ground.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
D | descript :: [Type => Str] $Arg = descriptfile$
File with HTML snippets that will be included as part of the main description content for the KML file.
E | extrude :: [Type => Str | []] $Arg = [altitude]$
Extrude feature down to ground level.
F | feature_type :: [Type => Str] $Arg = e|s|t|l|p|w$
Sets the feature type. Choose from points (event, symbol, or timespan), line, polygon, or wiggle.
G | fill :: [Type => Str] $Arg = f|nfill$
Sets color fill (G=:f) or label font color (G=:n).
I | icon :: [Type => Str] $Arg = icon$
Specify the URL to an alternative icon that should be used for the symbol [Default is a Google Earth circle].
K | not_over :: [Type => Bool]
Allow more KML code to be appended to the output later [finalize the KML file].
L | extra_data :: [Type => Str] $Arg = name1,name2,…$
Extended data given. Append one or more column names separated by commas.
N | feature_name :: [Type => Str | Number] $Arg = [t|col |name_template|name]$
By default, if segment headers contain a -L”label string” then we use that for the name of the KML feature.
O | overlay :: [Type => Bool]
Append KML code to an existing KML file [initialize a new KML file].
Qa | wiggles :: [Type => Str] $Arg = azimuth$
Option in support of wiggle plots (requires F=:w).
Qs | wiggle_scale :: [Type => Str | Number] $Arg = scale[unit]$
Required setting for wiggle plots (i.e., it requires F=:w). Sets a wiggle scale in z-data units per the user’s units
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | ilscale :: [Type => Str] $Arg = c|nscale$
Scale icons or labels. Here, S=:c sets a scale for the symbol icon, whereas S=:n sets a scale for the name labels
T | title :: [Type => Str] $Arg = title[/foldername]$
Sets the document title [default is unset]. Optionally, append /FolderName;
W | pen :: [Type => Str | []] $Arg = [pen][attr]$
Set pen attributes for lines, wiggles or polygon outlines.
Z | attrib :: [Type => Str] $Arg = args$
Set one or more attributes of the Document and Region tags.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? gmt2kiml$
GMT.gmtbegin
— Functiongmtbegin(name::String=""; fmt)
Start a GMT session in modern mode (GMT >= 6). 'name' contains the figure name with or without extension. If an extension is used (e.g. "map.pdf") it is used to select the image format.
As an alternative use 'fmt' as a string or symbol containing the format (ps, pdf, png, PNG, tif, jpg, eps).
By default name="GMTplot" and fmt="ps"
GMT.gmtconnect
— Functiongmtconnect(cmd0::String="", arg1=nothing, kwargs...)
Connect individual lines whose end points match within tolerance
See full GMT (not the GMT.jl
one) docs at gmtconnect
Parameters
C | closed :: [Type => Str | []]
Arg = [closed]
Write all the closed polygons to closed [gmtgmtconnect_closed.txt] and return all other segments as they are. No gmtconnection takes place.
D | dump :: [Type => Str | []]
Arg = [template]
For multiple segment data, dump each segment to a separate output file
L | links | linkfile :: [Type => Str | []]
Arg = [linkfile]
Writes the link information to the specified file [gmtgmtconnect_link.txt].
Q | list | listfile :: [Type => Str | []]
Arg = [listfile]
Used with D to write a list file with the names of the individual output files.
T | tolerance :: [Type => Str | List]
Arg = [cutoff[unit][/nn_dist]]
Specifies the separation tolerance in the data coordinate units [0]; append distance unit. If two lines has end-points that are closer than this cutoff they will be joined.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.gmtconvert
— Functiongmtconvert(cmd0::String="", arg1=nothing, kwargs...)
Convert, Paste, and/or Extract columns from data tables
See full GMT (not the GMT.jl
one) docs at gmtconvert
Parameters
A | hcat :: [Type => Str | []]
The records from the input files should be pasted horizontally, not appended vertically [Default].
C | n_records :: [Type => Str] $Arg = [+lmin][+umax][+i]$
Only output segments whose number of records matches your given criteria:
D | dump :: [Type => Str | []] $Arg = [template[+oorig]]$
For multiple segment data, dump each segment to a separate output file.
E | first_last :: [Type => Str | []] $Arg = [f|l|m|Mstride]$
Only extract the first and last record for each segment of interest.
F | conn_method :: [Type => Str | []] $Arg = [c|n|r|v][refpoint]$
Alter the way points are connected (by specifying a scheme) and data are grouped (by specifying a method).
I | invert | reverse :: [Type => Str | Bool] $Arg = [tsr]$
Invert the order of items, i.e., output the items in reverse order, starting with the last and ending up with the first item.
L | list_only :: -[Type => Bool]
Only output a listing of all segment header records and no data records.
N | sort :: [Type => Str | Number] $Arg = [-|+]col$
Numerically sort each segment based on values in column col.
Q | segments :: [Type => Str] $Arg = [~]selection$
Only write segments whose number is included in $selection$ and skip all others.
S | select_hdr :: [Type => Str] $Arg = [~]”search string” or [~]/regexp/[i]$
Only output those segments whose header record contains the specified text string.
T | suppress | skip :: [Type => Str | []] $Arg = [h|d]$
Suppress the writing of certain records on output. Append h to suppress segment headers [Default] or d to suppress duplicate data records. Use T=:hd to suppress both types of records.
W | word2num :: [Type => Str | []] $Arg = [+n]$
Attempt to gmtconvert each word in the trialing text to a number and append such values to the numerical output columns.
Z | transpose :: [Type => Str | []] $Arg = [first][:last]$
Limit output to the specified record range. If first is not set it defaults to record 0 (very first record) and if last is not set then it defaults to the very last record.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
q | inrow | inrows :: [Type => Str] $Arg = [i|o][~]rows[+ccol][+a|f|s]$
Select specific data rows to be read (-qi [Default]) or written (-qo) [all].
s | skiprows | skip_NaN :: [Type => Str] $Arg = [cols][a|r]$
Suppress output for records whose z-value equals NaN.
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.gmtend
— Functiongmtend(show=false, verbose=nothing)
Ends a GMT session in modern mode and optionaly shows the figure
GMT.gmtfig
— Methodgmtfig(name::String; fmt=nothing, opts="")
Set attributes for the current modern mode session figure.
- 'name' name of the new (or resumed) figure. It may contain an extension.
- 'fmt' figures graphics format (or formats, e.g. fmt="eps,pdf"). Not needed if 'name' has extension
- 'opts' Sets one or more comma-separated options (and possibly arguments) that can be passed to psconvert when preparing this figure.
GMT.gmtgravmag3d
— Functiongmtgravmag3d(cmd0::String=""; kwargs...)
Compute the gravity/magnetic anomaly of a 3-D body by the method of Okabe.
See full GMT (not the GMT.jl
one) docs at gmtgravmag3d
Parameters
C | density :: [Type => Str | GMTgrid]
Sets body density in SI. Provide either a constant density or a grid with a variable one.
F | track :: [Type => Str | Matrix | GMTdataset]
Provide locations where the anomaly will be computed. Note this option is mutually exclusive with
outgrid
.G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = gmtgravmag3d(....) form.
H | mag_params :: [Type => Number]
Sets parameters for computation of magnetic anomaly. Alternatively, provide a magnetic intensity grid.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
L | z_obs | observation_level :: [Type => Number]
Sets level of observation [Default = 0]. That is the height (z) at which anomalies are computed.
M | body :: [Type => Str | Tuple]
Create geometric bodies and compute their grav/mag effect.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | radius :: [Type => Number]
Set search radius in km (valid only in the two grids mode OR when
thickness
) [Default = 30 km].Tv | index :: [Type => Str]
Tr | raw_triang :: [Type => Str]
Ts | stl :: [Type => Str]
Gives names of a xyz and vertex (ndex="vert_file") files defining a close surface.
Z | z_level | reference_level :: [Type => Number]
Level of reference plane [Default = 0].
Example
G = gmtgravmag3d(M=(shape=:prism, params=(1,1,1,5)), inc=1.0, region="-15/15/-15/15", mag_params="10/60/10/-10/40");
imshow(G)
GMT.gmtinfo
— Methodgmtinfo(cmd0::String="", arg1=nothing; kwargs...)
Reads files and finds the extreme values in each of the columns.
See full GMT (not the GMT.jl
one) docs at gmtinfo
Parameters
A | ranges :: [Type => Str]
Specify how the range should be reported.
C | numeric | per_column :: [Type => Bool]
Report the min/max values per column in separate columns [Default uses <min/max> format].
D | center :: [Type => Bool]
Modifies results obtained by -I by shifting the region to better align with the center of the data.
E | get_record :: [Type => Str | []]
Returns the record whose column col contains the minimum (l) or maximum (h) value.
F | counts :: [Type => Str | []]
Returns the counts of various records depending on the appended mode.
I | inc | increment | spacing :: [Type => Str | Number | Tuple]
Report the min/max of the first n columns to the nearest multiple of the provided increments and output results in the form -Rw/e/s/n
L | common_limits :: [Type => Bool]
Determines common limits across tables or segments.
S | forerrorbars :: [Type => Str | []]
Add extra space for error bars. Useful together with I option and when later plotting with
plot E
.T | nearest_multiple :: [Type => Str | Number] $Arg = dz[+ccol]$
Report the min/max of the first (0’th) column to the nearest multiple of dz and output this as the string -Tzmin/zmax/dz.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.gmtisf
— Methodgmtisf(cmd0::String; kwargs...)
Read seismicity data in the a ISF formated file.
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
D | date :: date="datestart[/dateend]"
Limit the output to data >= datestart, or between datestart and dateend. <date> must be in ISO format, e.g, 2000-04-25.
F | focal :: [Type => Bool or Str or Symbol]
Select only events that have focal mechanisms. The default is Global CMT convention. Use
focal=:a
for the AKI conventionN | notime :: [Type => Bool]
Do NOT output time information.
abstime or unixtime
:: [Type => Integer]Convert the YYYY, MM, DD, HH, MM columns into a unixtime. Default puts it as first column, use
abstime=2
to put it as last column.yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
This module can also be called via gmtread
. I.,e. `gmtread("file.isf", opts...)_
GMT.gmtmath
— Methodgmtmath(cmd::String, args...)
Call gmtmath with all commands in a single string 'cmd'. This is not useful in itself as compared to call gmt("gmtmath ....") but it's very useful in 'movie' because it can generate shell scripts from the julai command
See full GMT (not the GMT.jl
one) docs at grdmath
GMT.gmtread
— Methodgmtread(fname::String; kwargs...)
Read GMT object from file. The object is one of "grid" or "grd", "image" or "img", "data" or "table", "cmap" or "cpt" and "ps" (for postscript), and OGR formats (shp, kml, json). Use a type specificatin to force a certain reading path (e.g. grd=true
to read grids) or take the chance of letting the data type be guessed via the file extension. Known extensions are:
- Grids: .grd .jp2 .nc
- Images: .jpg .jp2 .png, .tif, .tiff, .bmp, .webp
- Datasets: .dat .txt .csv .isf
- Datasets: .arrow .arrows .shp .kml .kmz .json .gmt .feather .fgb .gpkg .geojson .gpx .gml .ipc .parquet .sqlite
- CPT: .cpt
- PostScript: .ps, .eps
Parameters
Specify data type (with type=true, e.g. img=true
). Choose among:
grd
|grid
: Load a grid.img
|image
: Load an image.cpt
|cmap
: Load a GMT color palette.data
|dataset
|table
: Load a dataset (a table of numbers).ogr
: Load a dataset via GDAL OGR (a table of numbers). Many things can happen here.ps
: Load a PostScript filegdal
: Force reading the file via GDAL. Should only be used to read grids.varname
: When netCDF files have more than one 2D (or higher) variables use varname to pick the wished variable. e.g. $varname=:slp$ to read the variable named $slp$. This option defaults data type togrid
. This option can be used both with and without thegdal
option. Former case uses GMT lib to read the cube and outputs and 3D array in column major order, later case (the one withgdal
) uses GDAL to read the cube and outputs and 3D array in row major order. Remember that the $layout$ member of the GMTgrid type informs about memory layout.inrows
: Select specific data rows to be read. Valid args include ranges or a string with an hard core GMT -q option.stride
: When reading table data via GMT (but not GDAL), this option allows subsampling the data. Provide a number to be used as stride for the rows. Astride=2
will read every other row.layer
|layers
|band
|bands
: A string, a number or an Array. When files are multiband or nc files with 3D or 4D arrays, we access them via these keywords.layer=4
reads the fourth layer (or band) of the file. The file can be a grid or an image. If it is a grid, layer can be a scalar (to read 3D arrays) or an array of two elements (to read a 4D array). This option should not be used with thegdal
option.If file is an image,
layer
can be a 1 or a 1x3 array (to read a RGB image). Note that in this later case bands do not need to be contiguous. Aband=[1,5,2]
composes an RGB out of those bands. See more at http://docs.generic-mapping-tools.org/latest//GMT_Docs.html#modifiers-for-coards-compliant-netcdf-files) but note that we use 1 based indexing here.Use $layers=:all$ to read all levels of a 3D cube netCDF file.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
Example: to read a nc called 'lixo.grd'
G = gmtread("lixo.grd");
to read a jpg image with the bands reversed
I = gmtread("image.jpg", band=[2,1,0]);
GMT.gmtselect
— Functiongmtselect(cmd0::String="", arg1=nothing, kwargs...)
Select data table subsets based on multiple spatial criteria.
See full GMT (not the GMT.jl
one) docs at gmtselect
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
A | area :: [Type => Str | Number]
Features with an area smaller than minarea in km^2 or of hierarchical level that is lower than minlevel or higher than max_level will not be plotted.
C | dist2pt | dist :: [Type => Str | NamedTuple]
Arg = pointfile+ddist[unit] | (pts=Array, dist=xx)
Pass all records whose location is within dist of any of the points in the ASCII file pointfile. If dist is zero then the 3rd column of pointfile must have each point’s individual radius of influence.
D | res | resolution :: [Type => Str]
Arg = c|l|i|h|f
Ignored unless N is set. Selects the resolution of the coastline data set to use ((f)ull, (h)igh, (i)ntermediate, (l)ow, or (c)rude).
E | boundary :: [Type => Str | []]
Arg = [fn]
Specify how points exactly on a polygon boundary should be considered.
F | polygon :: [Type => Str | GMTdaset | Mx2 array]
Arg = polygonfile
Pass all records whose location is within one of the closed polygons in the multiple-segment file $polygonfile$ or a GMTdataset type or a Mx2 array defining the polygon.
G | gridmask :: [Type => Str | GRDgrid]
Arg = gridmask
Pass all locations that are inside the valid data area of the grid gridmask. Nodes that are outside are either NaN or zero.
I | invert | reverse :: [Type => Str | []]
Arg = [cflrsz]
Reverses the sense of the test for each of the criteria specified.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
L | dist2line :: [Type => Str | NamedTuple]
Arg = linefile+ddist[unit][+p] | (pts=Array, dist=xx, ortho=_)
Pass all records whose location is within dist of any of the line segments in the ASCII multiple-segment file linefile.
N | mask :: [Type => Str | List]
Arg = ocean/land/lake/island/pond or wet/dry
Pass all records whose location is inside specified geographical features.
Z | in_range :: [Type => Str | List]
Arg = min[/max][+a][+ccol][+i]
Pass all records whose 3rd column (z; col = 2) lies within the given range or is NaN.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.gmtset
— Methodgmtset(; kwargs...)
Adjust individual GMT defaults settings in the current directory’s gmt.conf file.
See full GMT (not the GMT.jl
one) docs at gmtset
Parameters
D | units :: [Type => Str | []]
Modify the GMT defaults based on the system settings. Append u for US defaults or s for SI defaults.
G | defaultsfile :: [Type => Str]
Name of specific gmt.conf file to read and modify.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
Example:
gmtset(FONT_ANNOT_PRIMARY="12p,Helvetica", MAP_GRID_CROSS_SIZE_PRIMARY=0.25)
GMT.gmtsimplify
— Methodgmtsimplify(cmd0::String="", arg1=nothing; kwargs...)
Line reduction using the Douglas-Peucker algorithm.
See full GMT (not the GMT.jl
one) docs at gmtsimplify
Parameters
T | tol | tolerance :: [Type => Str | Number]
Arg = tolerance[unit]
Specifies the maximum mismatch tolerance in the user units. If the data is not Cartesian then append the distance unit. (http://docs.generic-mapping-tools.org/latest/gmtsimplify.html#t)
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.gmtspatial
— Functiongmtspatial(cmd0::String="", arg1=nothing, kwargs...)
Geospatial operations on points, lines and polygons.
See full GMT (not the GMT.jl
one) docs at gmtspatial
Parameters
A | nn | nearest_neighbor :: [Type => Str]
Arg = [amin_dist][unit]
Perform spatial nearest neighbor (NN) analysis: Determine the nearest neighbor of each point and report the NN distances and the point IDs involved in each pair.
C | clip :: [Type => Bool]
Clips polygons to the map region, including map boundary to the polygon as needed. The result is a closed polygon.
D | duplicates :: [Type => Str]
Arg = [+ffile][+aamax][+ddmax][+c|Ccmax][+sfact]
Check for duplicates among the input lines or polygons, or, if file is given via +f, check if the input features already exist among the features in file.
E | handedness :: [Type => Str]
Arg = +|-
Reset the handedness of all polygons to match the given + (counter-clockwise) or - (clockwise). Implies Q+
F | force_polygons :: [Type => Str | []]
Arg = [l]
Force input data to become polygons on output, i.e., close them explicitly if not already closed. Optionally, append l to force line geometry.
I | intersections :: [Type => Str | []]
Arg = [e|i]
Determine the intersection locations between all pairs of polygons.
N | in_polygons | in_polyg :: [Type => Str]
Arg = pfile[+a][+pstart][+r][+z]
Determine if one (or all, with +a) points of each feature in the input data are inside any of the polygons given in the pfile.
Q | centroid or area or length :: [Type => Str]
Arg = [[unit][+cmin[/max]][+h][+l][+p][+s[a|d]]
Measure the area of all polygons or length of line segments.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | polygons :: [Type => Str]
Arg = h|i|j|s|u
Spatial processing of polygons.
T | truncate :: [Type => Str | []]
Arg = [clippolygon]
Truncate polygons against the specified polygon given, possibly resulting in open polygons.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | extend :: [Type => Str | Tuple]
Arg = <dist>[<unit>][+f|l]
Extend all segments with extra first and last points that are <dist> units away from the original end points in the directions implied by the line ends.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.gmtsplit
— Methodgmtsplit(cmd0::String="", arg1=nothing; kwargs...)
Reads a series of (x,y[,z]) records [or optionally (x,y,z,d,h)] and splits this into separate lists of (x,y[,z]) series, such that each series has a nearly constant azimuth through the x,y plane.
See full GMT (not the GMT.jl
one) docs at gmtsplit
Parameters
A | azim_tol :: [Type => Str | Array]
Write out only those segments which are within +/- tolerance degrees of azimuth in heading, measured clockwise from North, [0 - 360].
C | course_change :: [Type => Number]
Terminate a segment when a course change exceeding course_change degrees of heading is detected.
D | min_dist | min_distance :: [Type => Number]
Do not write a segment out unless it is at least minimum_distance units long.
F | filter :: [Type => Str | Array]
Filter the z values and/or the x,y values, assuming these are functions of d coordinate. xyfilter and zfilter are filter widths in distance units.
N | multi | multifile :: [Type => Bool | Str]
Write each segment to a separate output file.
Q | fields :: [Type => Str]
Specify your desired output using any combination of xyzdh, in any order.
S | dh | dist_head :: [Type => Bool]
Both d and h are supplied. In this case, input contains x,y,z,d,h. [Default expects (x,y,z) input, and d,h are computed from delta x, delta y.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
do | nodata_out :: [Type => Str or Number] $Arg = nodata$
Examine all output columns and if any item equals NAN substitute it with the chosen missing data value.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? splitxyz$
GMT.gmtvector
— Functiongmtvector(cmd0::String="", arg1=nothing, kwargs...)
Time domain filtering of 1-D data tables.
See full GMT (not the GMT.jl
one) docs at gmtvector
Parameters
A | primary_vec :: [Type => Str]
Arg = m[conf]|vector
Specify a single, primary vector instead of reading tables.
C | cartesian :: [Type => Str | []]
Arg = [i|o]
Select Cartesian coordinates on input and output.
E | geod2geoc :: [Type => Bool]
Convert input geographic coordinates from geodetic to geocentric and output geographic coordinates from geocentric to geodetic.
N | normalize :: [Type => Bool]
Normalize the resultant vectors prior to reporting the output.
S | secondary_vec :: [Type => Str | List]
Arg = [vector]
Specify a single, secondary vector in the same format as the first vector.
T | transform :: [Type => Str | List]
Arg = a|d|D|paz|s|r[arg|R|x]
Specify the vector transformation of interest.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.gmtwhich
— Methodgmtwhich(cmd0::String; kwargs...)
Find full path to specified files
See full GMT (not the GMT.jl
one) docs at gmtwhich
Parameters
- A | readable :: [Type => Bool]
Only consider files that the user has permission to read [Default consider all files found].
- C | confirm :: [Type => Bool]
Instead of reporting the paths, print the confirmation Y if the file is found and N if it is not.
- D | report_dir :: [Type => Bool]
Instead of reporting the paths, print the directories that contains the files.
- G | download :: [Type => Str | []] $Arg = [c|l|u]$
If a file argument is a downloadable file (either a full URL, a @file for downloading from
the GMT Site Cache, or @earth_relief_*.grd) we will try to download the file if it is not
found in your local data or cache dirs.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
GMT.gmtwrite
— Methodgmtwrite(fname::AbstractString, data; kwargs...)
Write a GMT object to file. The object is one of "grid" or "grd", "image" or "img", "dataset" or "table", "cmap" or "cpt" and "ps" (for postscript).
When saving grids, images and datasets we have a panoply of formats at our disposal. For the datasets case if the file name ends in .arrow, .shp, .json, .feather, .geojson, .gmt, .gpkg, .gpx, .gml or .parquet then it automatically selects $gdalwrite$ and saves the GMT dataset in that OGR vector format. The .kml is treated as a special case because there are GMT modules (e.g. gmt2kml
) that produce KML formatted data and so we write it directly as a text file.
Parameters
id
: [Type => Str]Use an $id$ code when not not saving a grid into a standard COARDS-compliant netCDF grid. This $id$ is made up of two characters like $ef$ to save in ESRI Arc/Info ASCII Grid Interchange format (ASCII float). See the full list of ids at http://docs.generic-mapping-tools.org/latest/grdconvert.html#format-identifier.
(http://docs.generic-mapping-tools.org/latest/grdconvert.html#g)
scale
|offset
: [Type => Number]You may optionally ask to scale the data and then offset them with the specified amounts. These modifiers are particularly practical when storing the data as integers, by first removing an offset and then scaling down the values.
nan
|novalue
|invalid
|missing
: [Type => Number]Lets you supply a value that represents an invalid grid entry, i.e., ‘Not-a-Number’.
gdal
: [Type => Bool]Force the use of the GDAL library to write the grid (to be used only with grids). (http://docs.generic-mapping-tools.org/latest/GMT_Docs.html#grid-file-format-specifications)
driver
: [Type => Str]When saving in other than the netCDF format we must tell the GDAL library what is wished format. That is done by specifying the driver name used by GDAL itself (e.g., netCDF, GTiFF, etc...).
datatype
: [Type => Str] $Arg = u8|u16|i16|u32|i32|float32$When saving with GDAL we can specify the data type from u8|u16|i16|u32|i32|float32 where ‘i’ and ‘u’ denote signed and unsigned integers respectively.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
Example: write the GMTgrid 'G' object into a nc file called 'lixo.grd'
gmtwrite("lixo.grd", G);
GMT.graticules
— Methodgrat = graticules(D, width=(30,20), grid=nothing, annot_x=nothing)
or
grat = graticules(; proj="projection", width=(30,20), pm=0, grid=nothing, annot_x=nothing)
Create a projected graticule GMTdataset with meridians and parallels at width
intervals.
D
: A GMTdataset (or vector of them) holding the projection info. Instead of GMTdataset type, this argument may also be a referenced grid or image type.proj
: Alternatively pass a proj4 string or Symbol describing the projectionpm
: The projection prime meridian (Default is 0 or whatever is in D.proj4).width
: A scalar or two elements array/tuple with increments in longitude and latitude. If scalar, widthx = widthy.grid
: Instead of using thewidth
argument, that generates an automatic set of graticules, one may pass a two elements Vector{Vector{Real}} with the meridians (grid[1]) and parallels (grid[2]) to create.annot_x
: By default, all meridians are annotated whengrat
is used in theplotgrid!
function, but depending on the projection and thelatlim
argument used inworldrectangular
we may have the longitude labels overlap close to the prime meridian. To minimize that pass a vector of longitudes to be annotated. e.g.annot_x=[-180,-150,0,150,180]
will annotate only those longitudes.
Returns
A Vector of GMTdataset containing the projected meridians and parallels. grat[i]
attributes store information about that element lon,lat.
Example
grat = graticules(proj="+proj=ob_tran +o_proj=moll +o_lon_p=40 +o_lat_p=50 +lon_0=60");
GMT.gravfft
— Functiongravfft(cmd0::String="", arg1=nothing, arg2=nothing; kwargs...)
Spectral calculations of gravity, isostasy, admittance, and coherence for grids.
See full GMT (not the GMT.jl
one) docs at gravfft
Parameters
D | density :: [Type => Str | GMTgrid]
Sets body density in SI. Provide either a constant density or a grid with a variable one.
E | n_terms :: [Type => Number]
Number of terms used in Parker expansion [Default = 3].
F | geopotential :: [Type => Str | Tuple]
Specify desired geopotential field: compute geoid rather than gravity
I | admittance :: [Type => Number]
Use ingrid2 and ingrid1 (a grid with topography/bathymetry) to estimate admittance|coherence and return a GMTdataset.
N | inquire :: [Type => Str] $Arg = [a|f|m|r|s|nx/ny][+a|[+d|h|l][+e|n|m][+twidth][+v][+w[suffix]][+z[p]]$
Choose or inquire about suitable grid dimensions for FFT and set optional parameters. Control the FFT dimension:
Q | flex_topo | flexural_topography :: [Type => Bool]
Computes grid with the flexural topography.
S | subplate | subplate_load :: [Type => Bool]
Computes predicted gravity or geoid grid due to a subplate load produced by the current bathymetry and the theoretical model.
T | topo_load :: [Type => Str]
Compute the isostatic compensation from the topography load (input grid file) on an elastic plate of thickness
te
.W | z_obs | observation_level :: [Type => Number]
Set water depth (or observation height) relative to topography in meters [0]. Append k to indicate km.
Z | moho_depth :: [Type => Number]
Moho [and swell] average compensation depths (in meters positive down).
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
Example. Compute the gravity effect of the Gorringe bank.
G = grdcut("@earth_relief_10m", region=(-12.5,-10,35.5,37.5));
G2 = gravfft(G, density=1700, F=(faa=6,slab=4), f=:g);
imshow(G2)
GMT.gravprisms
— Functiongravprisms(cmd0::String="", arg1=nothing; kwargs...)
Compute the gravity/magnetic anomaly of a 3-D body by the method of Okabe.
See full GMT (not the GMT.jl
one) docs at gravprisms
Parameters
A | zup :: [Type => Bool]
The z-axis should be positive upwards [Default is down].
C | density :: [Type => Str | GMTgrid]
Sets body density in SI. Provide either a constant density or a grid with a variable one.
E | dxdy | xy_sides :: [Type => Number | Tuple numbers]
If all prisms in table have constant x/y-dimensions then they can be set here. In that case table must~ only contain the centers of each prism and the z range
F | component :: [Type => Str]
Specify desired gravitational field component.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = gravprisms(....) form.
H | radial_rho :: [Type => Str | Tuple]
Set reference seamount parameters for an ad-hoc variable radial density function with depth.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
L | base :: [Type => Number ! Grid]
Give name of the base surface grid for a layer we wish to approximate with prisms, or give a constant z-level [0].
M | units :: [Type => Str]
Sets distance units used. units=:horizontal to indicate that both horizontal distances are in km [m].
N | track :: [Type => Str | Matrix | GMTdataset]
Specifies individual (x, y[, z]) locations where we wish to compute the predicted value.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | topography :: [Type => Number]
Give name of grid with the full seamount heights, either for making prisms or as required by H.
T | top :: [Type => Number | Grid]
Give name of the top surface grid for a layer we wish to approximate with prisms, or give a constant z-level.
Z | z_obs | observation_level :: [Type => Number | Grid]
Set observation level, either as a constant or variable by giving the name of a grid with observation levels.
T | top :: [Type => Number | Grid]
Give name of the top surface grid for a layer we wish to approximate with prisms, or give a constant z-level.
W | outmeanrho :: [Type => Str]
Give name of an output grid with spatially varying, vertically-averaged prism densities created by C and H.
GMT.grays2cube
— Method[I =] grays2cube(layers::GMTimage{UInt8,2}...; names::Vector{String}=String[], save::String="") -> GMTimage
Take N grayscale UInt8 GMTimages and agregate them into an image cube. Optionally provide a vector of names for each layer. If the save
option is provided, we save the cube as a GeoTIFF file. Note, no need to provide an extension as the output name will always be '*.tiff'.
Example
# Make a cube with the Cb, Cr, a* and b* comonents of YCbCR & La*b* color spaces of an RGB image
I = mat2image(rand(UInt8,128, 128, 3)) # Create sample RGB image
_,Cb,Cr = rgb2YCbCr(I, Cb=true, Cr=true); # Extract Cb and Cr components
L,a,b = rgb2lab(I, L=true); # Extract La*b* components
Icube = grays2cube(Cb, Cr, a, b; names=["Cb", "Cr", "a", "b"]);
GMT.grays2rgb
— MethodI = grays2rgb(bandR, bandG, bandB, GI=nothing) -> GMTimage
Take three grayscale images as UInt8 matrices or GMTimages and compose an RGB image by simply copying the values of each band into the respective color channel of the output image. When the inputs are UInt8 matrices optionally provide a GMTgrid or GMTimage as fourth argument to set georeferencing info on output. The output is always a GMTimage object.
Note, do not confuse this function with ind2rgb
that takes a single indexed image and creates a RGB using the image's colormap.
Example
I1 = mat2img(rand(UInt8, 16,16)); I2 = mat2img(rand(UInt8, 16,16)); I3 = mat2img(rand(UInt8, 16,16));
Irgb = grays2rgb(I1,I2,I3)
GMT.grd2cpt
— Methodgrd2cpt(cmd0::String="", arg1=nothing, kwargs...)
Make linear or histogram-equalized color palette table from grid
See full GMT (not the GMT.jl
one) docs at grd2cpt
Parameters
A | alpha | transparency :: [Type => Str]
Sets a constant level of transparency (0-100) for all color slices.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
D | bg | background :: [Type => Str | []]
Arg = [i|o]
Select the back- and foreground colors to match the colors for lowest and highest z-values in the output CPT.
E | nlevels :: [Type => Int | []]
Arg = [nlevels]
Create a linear color table by using the grid z-range as the new limits in the CPT. Alternatively, append nlevels and we will resample the color table into nlevels equidistant slices.
F | color_model :: [Type => Str | []]
Arg = [R|r|h|c][+c]]
Force output CPT to written with r/g/b codes, gray-scale values or color name.
G | truncate :: [Type => Str]
Arg = zlo/zhi
Truncate the incoming CPT so that the lowest and highest z-levels are to zlo and zhi.
I | inverse | reverse :: [Type => Str]
Arg = [c][z]
Reverse the sense of color progression in the master CPT.
L | datarange | clim :: [Type => Str]
Arg = minlimit/maxlimit
Limit range of CPT to minlimit/maxlimit, and don’t count data outside this range when estimating CDF(Z). [Default uses min and max of data.]
M | overrule_bg :: [Type => Bool]
Overrule background, foreground, and NaN colors specified in the master CPT with the values of the parameters COLORBACKGROUND, COLORFOREGROUND, and COLOR_NAN.
N | no_bg | nobg :: [Type => Bool]
Do not write out the background, foreground, and NaN-color fields.
Q | log :: [Type => Bool]
Selects a logarithmic interpolation scheme [Default is linear].
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | symmetric :: [Type => Str]
Arg = h|l|m|u
Force the color table to be symmetric about zero (from -R to +R).
T | range :: [Type => Str]
Arg = (min,max,inc) or = "n"
Set steps in CPT. Calculate entries in CPT from zstart to zstop in steps of (zinc). Default chooses arbitrary values by a crazy scheme based on equidistant values for a Gaussian CDF.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | categorical :: [Type => Bool | Str | []]
Arg = [w]
Do not interpolate the input color table but pick the output colors starting at the beginning of the color table, until colors for all intervals are assigned.
Z | continuous :: [Type => Bool]
Creates a continuous CPT [Default is discontinuous, i.e., constant colors for each interval].
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
GMT.grd2kml
— Functiongrd2kml(cmd0::String="", arg1=nothing, kwargs...)
Reads a 2-D grid file and makes a quadtree of PNG images and KML wrappers for Google Earth using the selected tile size [256x256 pixels].
See full GMT (not the GMT.jl
one) docs at grd2kml
Parameters
A | mode :: [Type => Str]
Arg = url
Select one of three altitude modes recognized by Google Earth that determines the altitude (in m) of the tile layer.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
E | url :: [Type => Str]
Arg = url
Instead of hosting the files locally, prepend a site URL. The top-level prefix.kml file will then use this URL to find the other files it references.
F | filter :: [Type => Str]
Specifies the filter to use for the downsampling of the grid for more distant viewing. Choose among boxcar, cosine arch, gaussian, or median [Gaussian].
H | sub_pixel | subpixel :: [Type => Int]
Arg = factor
Improve the quality of rasterization by passing the sub-pixel smoothing factor to psconvert.
I | shade | shading | intensity :: [Type => Str | GMTgrid]
Gives the name of a grid file or GMTgrid with intensities in the (-1,+1) range, or a grdgradient shading flags.
L | tilesize | tile_size :: [Type => Number]
Arg = tilesize
Sets the fixed size of the image building blocks. Must be an integer that is radix 2. Typical values are 256 or 512 [256].
N | prefix [Type => Str]
Arg = prefix
Sets a unique name prefixed used for the top-level KML filename and the directory where all referenced KML files and PNG images will be written [GMT_Quadtree].
Q | nan_t | nan_alpha :: [Type => Bool]
Make grid nodes with z = NaN transparent, using the color-masking feature in PostScript Level 3.
S | extra_layers | extralayers :: [Type => Str]
Add extra layers beyond that necessary to capture the full resolution of the data.
T | title :: [Type => Str]
Arg = title
Sets the title of the top-level document (i.e., its description).
W | contours :: [Type => Str]
Arg = title
Supply a file with records each holding a contour value and a contour pen.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
GMT.grd2xyz
— Methodgrd2xyz(cmd0::String="", arg1=nothing, kwargs...)
Reads one 2-D grid and returns xyz-triplets.
See full GMT (not the GMT.jl
one) docs at grd2xyz
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
C | row_col | rowcol :: [Type => Bool]
Replace the x- and y-coordinates on output with the corresponding column and row numbers.
L | hvline :: [Type => String]
Limit the output of records to a single row or column.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
T | stl | STL :: [Type => String]
Compute a STL triangulation for 3-D printing.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | weight :: [Type => Str]
Arg = [a|weight]
Write out x,y,z,w, where w is the supplied weight (or 1 if not supplied) [Default writes x,y,z only].
Z | onecol | one_col :: [Type => Str]
Write a 1-column table. Output will be organized according to the specified ordering convention contained in $flags$.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
s | skiprows | skip_NaN :: [Type => Str] $Arg = [cols][a|r]$
Suppress output for records whose z-value equals NaN.
GMT.grdblend
— Functiongrdblend(cmd0::String="", arg1=nothing, arg2=nothing, kwargs...)
Reads a listing of grid files and blend parameters, or up to 2 GTMgrid types, and creates a grid by blending the other grids using cosine-taper weights.
See full GMT (not the GMT.jl
one) docs at grdblend
Parameters
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit. (http://docs.generic-mapping-tools.org/latest/grdblend.html#i)
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdblend(....) form.
C | clobber :: [Type => Str | []] $Arg = f|l|o|u[±]$
Clobber mode: Instead of blending, simply pick the value of one of the grids that covers a node.
N | nodata :: [Type => Str | Number]
No data. Set nodes with no input grid to this value [Default is NaN].
Q | headless :: [Type => Bool]
Create plain header-less grid file (for use with external tools). Requires that the output grid file is a native format (i.e., not netCDF). DO NOT USE WITH G.
W | no_blend :: [Type => Str | []]
Do not blend, just output the weights used for each node [Default makes the blend]. Append $z$ to write the weight*z sum instead.
Z | scale :: [Type => Number]
Scale output values by scale before writing to file.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
GMT.grdclip
— Methodgrdclip(cmd0::String="", arg1=nothing; kwargs...)
Clip the range of grid values. will set values < low to below and/or values > high to above. You can also specify one or more intervals where all values should be set to $between$, or replace individual values.
See full GMT (not the GMT.jl
one) docs at grdclip
Parameters
cmd0 :: [Type => Str]
The input file name. Do not use this when the grid (a GMTgrid type) is passed via the $arg1$ argument.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdclip(....) form.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
above | high :: [Type => Array | Str]
Two elements array with $high$ and $above$ or a string with "high/above". It sets all data[i] > $high$ to $above$.
below | low :: [Type => Array | Str]
Two elements array with $low$ and $below$ or a string with "low/below". It sets all data[i] < $low$ to $below$.
between :: [Type => Array | Str]
Three elements array with $low, high$ and $between$ or a string with "low/high/between". It sets all data[i] >= $low$ and <= $high$ to $between$.
old | new :: [Type => Array | Str]
Two elements array with $old$ and $new$ or a string with "old/new". It sets all data[i] == $old$ to $new$.
S :: [Type => Str]
Condense all replacement options above in a single string.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
Examples:
G=gmt("grdmath", "-R0/10/0/10 -I1 X"); G2=grdclip(G, above=[5 6], low=[2 2], between="3/4/3.5")
or (note the use of -S for second on options because we can't repeat a kwarg name)
G2=grdclip(G, S="a5/6 -Sb2/2 -Si3/4/3.5")
GMT.grdcontour
— Methodgrdcontour(cmd0::String="", arg1=nothing; kwargs...)
Reads a 2-D grid file or a GMTgrid type and produces a contour map by tracing each contour through the grid.
See full GMT (not the GMT.jl
one) docs at grdcontour
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
A | annot | annotation :: [Type => Str or Number] $Arg = [-|[+]annot_int][labelinfo]$
annot_int is annotation interval in data units; it is ignored if contour levels are given in a file.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | cont | contour | contours | levels :: [Type => Str | Number | GMTcpt] $Arg = [+]cont_int$
Contours to be drawn may be specified in one of three possible ways.
D | dump :: [Type => Str]
Dump contours as data line segments; no plotting takes place.
F | force :: [Type => Str | []]
Force dumped contours to be oriented so that higher z-values are to the left (-Fl [Default]) or right.
G | labels :: [Type => Str]
Controls the placement of labels along the quoted lines.
Jz | zscale | zsize :: [Type => String]
L | range :: [Type => Str]
Limit range: Do not draw contours for data values below low or above high.
N | fill | colorize :: [Type => Bool]
Fill the area between contours using the discrete color table given by cpt.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | cut :: [Type => Str | Number]
Do not draw contours with less than cut number of points.
S | smooth :: [Type => Number]
Used to resample the contour lines at roughly every (gridbox_size/smoothfactor) interval.
T | ticks :: [Type => Str]
Draw tick marks pointing in the downward direction every gap along the innermost closed contours.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | pen :: [Type => Str | Number]
Sets the attributes for the particular line.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
Z | muladd | scale :: [Type => Str]
Use to subtract shift from the data and multiply the results by factor before contouring starts.
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
do | nodata_out :: [Type => Str or Number] $Arg = nodata$
Examine all output columns and if any item equals NAN substitute it with the chosen missing data value.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? grdcontour$
GMT.grdconvert
— Methodgrdconvert(fname::AbstractString)
Read a gridded dataset stored in a $x y z$ text file with an extension $.xyz$ (note that this detail is mandatory) and return a GMTgrid object. By "gridded dataset" it is meant that the file contains an already gridded dataset. Scattered $xyz$ points are not wellcome here.
GMT.grdcut
— Methodgrdcut(cmd0::String="", arg1=[], kwargs...)
Produce a new outgrid which is a subregion of ingrid. The subregion is specified with $limits$ (the -R); the specified range must not exceed the range of ingrid (but see $extend$).
See full GMT (not the GMT.jl
one) docs at grdcut
Parameters
E | rowlice | colslice :: [Type => Number]
Extract a vertical slice going along the x-column coord or along the y-row coord.
F | clip | cutline :: [Type => Str | GMTdaset | Mx2 array | NamedTuple]
Arg = array|fname[+c] | (polygon=Array|Str, crop2cutline=Bool, invert=Bool)
Specify a closed polygon (either a file or a dataset). All grid nodes outside the polygon will be set to NaN.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdcut(....) form.
img | usegdal | gdal :: [Type => Any]
Force the cut operation to be done by GDAL. Works for images where GMT fails or even crash.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
N | extend :: [Type => Str or []]
Allow grid to be extended if new region exceeds existing boundaries. Append nodata value to initialize nodes outside current region [Default is NaN].
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | circ_subregion :: [Type => Str] $Arg = [n]lon/lat/radius[unit]$
Specify an origin and radius; append a distance unit and we determine the corresponding rectangular region so that all grid nodes on or inside the circle are contained in the subset.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
Z | range :: [Type => Str] $Arg = [n|N |r][min/max]$
Determine a new rectangular region so that all nodes outside this region are also outside the given z-range.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
GMT.grdedit
— Methodgrdedit(cmd0::String="", arg1=nothing, kwargs...)
Reads the header information in a binary 2-D grid file and replaces the information with values provided on the command line.
If single input is a G GMTgrid object, it will update the z_min|max values of the G.range member
See full GMT (not the GMT.jl
one) docs at grdedit
Parameters
A | adjust_inc :: [Type => Bool]
If necessary, adjust the file’s xinc, yinc to be compatible with its domain.
C | adjust_inc :: [Type => Bool]
Clear the command history from the grid header.
D | header | metadata :: [Type => Str] $Arg = [+xxname][+yyname][+zzname][+sscale][+ooffset][+ninvalid][+ttitle][+rremark$
Change these header parameters.
E | flip :: [Type => Str] $Arg = [a|h|l|r|t|v]$
Transform the grid in one of six ways and (for l|r|t) interchange the x and y information
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdedit(....) form.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
N | replace :: [Type => Str | Mx3 array] $Arg = replace=fname | replace=Array$
Read the ASCII (or binary) file table and replace the corresponding nodal values in the grid with these x,y,z values. Alternatively, provide a Mx3 matrix with values to be changed.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | wrap :: [Type => Bool]
For global, geographical grids only. Grid values will be shifted longitudinally according to the new borders given in $limits$ (R option).
T | toggle_reg | toggle :: [Type => Bool]
Make necessary changes in the header to convert a gridline-registered grid to a pixel-registered grid, or vice-versa.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.grdfft
— Functiongrdfft(cmd0::String="", arg1=nothing, [arg2=nothing,] kwargs...)
Take the 2-D forward Fast Fourier Transform and perform one or more mathematical operations in the frequency domain before transforming back to the space domain.
See full GMT (not the GMT.jl
one) docs at grdfft
Parameters
A | azim :: [Type => Number] $Arg = azim$
Take the directional derivative in the azimuth direction measured in degrees CW from north.
C | upward :: [Type => Number] $Arg = zlevel$
Upward (for zlevel > 0) or downward (for zlevel < 0) continue the field zlevel meters.
D | dfdz :: [Type => Str or Number] $Arg = [scale|g]$
Differentiate the field, i.e., take d(field)/dz. This is equivalent to multiplying by kr in the frequency domain (kr is radial wave number).
E | radial_power :: [Type => Str] $Arg = [r|x|y][+w[k]][+n]$
Estimate power spectrum in the radial direction [r]. Place x or y immediately after E to compute the spectrum in the x or y direction instead.
F | filter :: [Type => Str or List– $Arg = [r|x|y]params$
Filter the data. Place x or y immediately after -F to filter x or y direction only; default is isotropic [r]. Choose between a cosine-tapered band-pass, a Gaussian band-pass filter, or a Butterworth band-pass filter.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name (or table if radial_power is used). Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdfft(....) form.
I | integrate :: [Type => Str or Number] $Arg = [scale|g]$
Integrate the field, i.e., compute integraloverz (field * dz). This is equivalent to divide by kr in the frequency domain (kr is radial wave number).
N | inquire :: [Type => Str] $Arg = [a|f|m|r|s|nx/ny][+a|[+d|h|l][+e|n|m][+twidth][+v][+w[suffix]][+z[p]]$
Choose or inquire about suitable grid dimensions for FFT and set optional parameters. Control the FFT dimension:
S | scale :: [Type => Number] $Arg = scale$
Multiply each element by scale in the space domain (after the frequency domain operations).
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
GMT.grdfill
— Methodgrdfill(cmd0::String="", arg1=nothing, kwargs...)
Reads a grid that presumably has unfilled holes that the user wants to fill in some fashion. Holes are identified by NaN values but this criteria can be changed.
See full GMT (not the GMT.jl
one) docs at grdfill
Parameters
A | mode :: [Type => Str] $Arg = mode[arg]$
Specify the hole-filling algorithm to use. Choose from c for constant fill and append the constant value, n for nearest neighbor (and optionally append a search radius in pixels).
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdfill(....) form.
L | list :: [Type => Str] $Arg = [p]$
Just list the rectangular subregions west east south north of each hole. No grid fill takes place and outgrid is ignored. Optionally, append p to instead write closed polygons for all subregions.
N | nodata :: [Type => Str] $Arg = nodata$
Sets the node value that identifies a point as a member of a hole [Default is NaN].
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
GMT.grdfilter
— Methodgrdfilter(cmd0::String="", arg1=nothing, kwargs...)
Filter a grid file in the time domain using one of the selected convolution or non-convolution isotropic or rectangular filters and compute distances using Cartesian or Spherical geometries.
See full GMT (not the GMT.jl
one) docs at grdfilter
Parameters
F | filter :: [Type => Str]
Sets the filter type.
D | distflag | distance :: [Type => Number]
Distance flag tells how grid (x,y) relates to filter width.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdfilter(....) form.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
N | nans :: [Type => Str]
Determine how NaN-values in the input grid affects the filtered output. Values are i|p|r
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
T | toggle :: [Type => Bool]
Toggle the node registration for the output grid so as to become the opposite of the input grid
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
To see the full documentation type: $@? grdfilter$
GMT.grdgradient
— Methodgrdgradient(cmd0::String="", arg1=nothing, kwargs...)
Compute the directional derivative in a given direction, or to find the direction [and the magnitude] of the vector gradient of the data.
See full GMT (not the GMT.jl
one) docs at grdgradient
Parameters
A | azim | azimuth :: [Type => Str | Number] $Arg = azim[/azim2]$
Azimuthal direction for a directional derivative.
D | find_dir :: [Type => Str] $Arg = [a][c][o][n]$
Find the direction of the positive (up-slope) gradient of the data.
G | save | write | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdgradient(....) form.
E | lambert :: [Type => Str] $Arg = [m|s|p]azim/elev[+aambient][+ddiffuse][+pspecular][+sshine]$
Compute Lambertian radiance appropriate to use with grdimage and grdview.
N | norm | normalize :: [Type => Str] $Arg = [e|t][amp][+ssigma][+ooffset]$
Normalization. [Default is no normalization.] The actual gradients g are offset and scaled to produce normalized gradients.
Q | save_stats :: [Type => Str] $Arg = c|r|R$
Controls how normalization via N is carried out.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | slopegrid :: [Type => Str]
Name of output grid file with scalar magnitudes of gradient vectors. Requires D but makes G optional.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
To see the full documentation type: $@? grdgradient$
GMT.grdgravmag3d
— Functiongrdgravmag3d(cmd0::String="", arg1=nothing, arg2=nothing; kwargs...)
Compute the gravity/magnetic anomaly of the volume contained between a surface provided by one grid and a plane, or between a top and a bottom surface provided by two grids.
See full GMT (not the GMT.jl
one) docs at grdgravmag3d
Parameters
C | density :: [Type => Str | GMTgrid]
Sets body density in SI. Provide either a constant density or a grid with a variable one.
F | track :: [Type => Str | Matrix | GMTdataset]
Provide locations where the anomaly will be computed. Note this option is mutually exclusive with
outgrid
.G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdgravmag3d(....) form.
E | thickness :: [Type => Number]
Provide the layer thickness in m [Default = 500 m].
H | mag_params :: [Type => Number]
Sets parameters for computation of magnetic anomaly. Alternatively, provide a magnetic intensity grid.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
L | z_obs | observation_level :: [Type => Number]
Sets level of observation [Default = 0]. That is the height (z) at which anomalies are computed.
Q | pad :: [Type => Number]
Extend the domain of computation with respect to output
region
.R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | radius :: [Type => Number]
Set search radius in km (valid only in the two grids mode OR when
thickness
) [Default = 30 km].Z | z_level | reference_level :: [Type => Number]
Level of reference plane [Default = 0].
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
x | cores | n_threads :: [Type => Str or Number] $Arg = [[-]n]$
Limit the number of cores to be used in any OpenMP-enabled multi-threaded algorithms. (http://docs.generic-mapping-tools.org/latest/gmt.html#x-full)
Example. Compute the gravity effect of the Gorringe bank.
G = grdgravmag3d("@earth_relief_10m", region=(-12.5,-10,35.5,37.5), density=2700, inc=0.05, pad=0.5, z_level=:bottom, f=:g);
imshow(G)
GMT.grdhisteq
— Methodgrdhisteq(cmd0::String="", arg1=nothing, kwargs...)
Find the data values which divide a given grid file into patches of equal area. One common use of grdhisteq is in a kind of histogram equalization of an image.
See full GMT (not the GMT.jl
one) docs at grdhisteq
Parameters
C | ncels | n_cels :: [Type => Number]
Sets how many cells (or divisions) of data range to make [16].
D | dump :: [Type => Str or []]
Dump level information to file, or standard output if no file is provided.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdhisteq(....) form.
N | gaussian :: [Type => Number or []]
Gaussian output.
Q | quadratic :: [Type => Bool]
Quadratic output. Selects quadratic histogram equalization. [Default is linear].
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
To see the full documentation type: $@? grdhisteq$
GMT.grdimage
— Functiongrdimage(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; kwargs...)
Produces a gray-shaded (or colored) map by plotting rectangles centered on each grid node and assigning them a gray-shade (or color) based on the z-value.
Parameters
A | img_out | image_out :: [Type => Str]
Save an image in a raster format instead of PostScript.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
D | img_in | image_in :: [Type => Str]
Specifies that the grid supplied is an image file to be read via GDAL.
E | dpi :: [Type => Int]
Sets the resolution of the projected grid that will be created.
G | bit_color :: [Type => Int]
I | shade | shading | intensity :: [Type => Bool | Str | GMTgrid]
Gives the name of a grid file or GMTgrid with intensities in the (-1,+1) range, or a grdgradient shading flags.
M | monochrome :: [Type => Bool]
Force conversion to monochrome image using the (television) YIQ transformation.
N | noclip :: [Type => Bool]
Do not clip the image at the map boundary.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | alpha_color | nan_alpha :: [Type => Bool | Tuple | Str] $Q = true | Q = (r,g,b)$
Make grid nodes with z = NaN transparent, or pick a color for transparency in a image.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? grdimage$
GMT.grdinfo
— Methodgrdinfo(cmd0::String="", arg1=nothing; kwargs...)
Reads a 2-D grid file and reports metadata and various statistics for the (x,y,z) data in the grid file
See full GMT (not the GMT.jl
one) docs at grdinfo
Parameters
C | oneliner | numeric :: [Type => Str | Number]
Formats the report using tab-separated fields on a single line.
D | tiles :: [Type => Number | Str]
Divide a single grid’s domain (or the -R domain, if no grid given) into tiles of size dx times dy (set via -I).
E | extrema | extreme :: [Type => Bool]
Report the extreme values found on a per column (E=:x) or per row (E=:y) basis.
F | report_ingeog :: [Type => Bool]
Report grid domain and x/y-increments in world mapping format.
G | download :: [Type => Bool]
Force (possible) download and mosaicing of all tiles of tiled global remote grids in order to report the requested information.
I | nearest :: [Type => Number | Str] $Arg = [dx[/dy]|b|i|r]$
Report the min/max of the region to the nearest multiple of dx and dy, and output this in the form -Rw/e/s/n
L | force_scan :: [Type => Number | Str]
Report stats after actually scanning the data.
M | minmax_pos :: [Type => Bool]
Find and report the location of min/max z-values.
Q | cube :: [Type => Bool]
Input files must be data 3-D netCDF data cube. Not compatible with D, E, F, and Ib (GMT6.2)
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
T | minmax :: [Type => Number | Str] Determine min and max z-value.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
To see the full documentation type: $@? grdinfo$
GMT.grdinterpolate
— Methodgrdinterpolate(cmd0="", arg1=nothing, arg2=nothing; kwargs...)
Interpolate a 3-D cube, 2-D grids or 1-D series from a 3-D data cube or stack of 2-D grids.
See full GMT (not the GMT.jl
one) docs at grdinterpolate
Parameters
D | meta | metadata :: [Type => Str | NamedTuple]
Give one or more combinations for values xname, yname, zname (3rd dimension in cube), and dname (data value name) and give the names of those variables and in square bracket their units
E | crossection :: [Type => Str | GMTdtaset | NamedTuple]
Specify a crossectinonal profile via a file or from specified line coordinates and modifiers. If a file, it must be contain a single segment with either lon lat or lon lat dist records. These must be equidistant.
F | interp_type | interpolator :: [Type => Str] $Arg = l|a|c|n[+1|+2]$
Choose from l (Linear), a (Akima spline), c (natural cubic spline), and n (no interpolation: nearest point) [Default is Akima].
G | outfile | outgrid :: [Type => Str]
Output file name. If
range
only selects a single layer then the data cube collapses to a regular 2-D grid fileR | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | pt | track :: [Type => Str | Tuple | Dataset]
Arg = x/y|pointfile[+hheader]
Rather than compute gridded output, create tile/spatial series through the stacked grids at the given point (x/y) or the list of points in pointfile.
T | range :: [Type => Str]
Arg = [min/max/]inc[+i|n] |-Tfile|list
Make evenly spaced time-steps from min to max by inc [Default uses input times].
Z | levels :: [Type => range]
Arg = [levels]
The
levels
may be specified the same way as inrange
. If not given then we default to an integer levels array starting at 0.V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
q | inrow | inrows :: [Type => Str] $Arg = [i|o][~]rows[+ccol][+a|f|s]$
Select specific data rows to be read (-qi [Default]) or written (-qo) [all].
s | skiprows | skip_NaN :: [Type => Str] $Arg = [cols][a|r]$
Suppress output for records whose z-value equals NaN.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
When using two numeric inputs and no outfile
option, the order of the x,y and grid is not important. That is, both of this will work: $D = grdinterpolate([0 0], G);$ or $D = grdinterpolate(G, [0 0]);$
When using the pt
or crossection
options the default is to NOT ouput the redundant horizontal x,y coordinates (contrary to the GMT default). If you want to have them, use option colinfo
, e.g. colinfo="0-3"
, or use allcols=true
.
To see the full documentation type: $@? grdinterpolate$
GMT.grdlandmask
— Methodgrdlandmask([monolithic::String="";] area=, resolution=, bordervalues=, save=, maskvalues=, registration=, verbose=, cores=)
Create a grid file with set values for land and water.
Read the selected shoreline database and create a grid to specify which nodes in the specified grid are over land or over water. The nodes defined by the selected region and lattice spacing will be set according to one of two criteria: (1) land vs water, or (2) the more detailed (hierarchical) ocean vs land vs lake vs island vs pond.
See full GMT (not the GMT.jl
one) docs at grdlandmask
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
A | area :: [Type => Str | Number]
Features with an area smaller than minarea in km^2 or of hierarchical level that is lower than minlevel or higher than max_level will not be plotted.
D | res | resolution :: [Type => Str]
Selects the resolution of the data set to use ((f)ull, (h)igh, (i)ntermediate, (l)ow, and (c)rude).
E | border | bordervalues :: [Type => Str | List] $Arg = cborder/lborder/iborder/pborder or bordervalue$
Nodes that fall exactly on a polygon boundary should be considered to be outside the polygon [Default considers them to be inside].
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdlandmask(....) form.
N | maskvalues | mask :: [Type => Str | List] $Arg = wet/dry or ocean/land/lake/island/pond$
Sets the values that will be assigned to nodes. Values can be any number, including the textstring NaN
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
x | cores | n_threads :: [Type => Str or Number] $Arg = [[-]n]$
Limit the number of cores to be used in any OpenMP-enabled multi-threaded algorithms. (http://docs.generic-mapping-tools.org/latest/gmt.html#x-full)
To see the full documentation type: $@? grdlandmask$
GMT.grdmask
— Methodgrdmask(cmd0::String="", arg1=nothing, kwargs...)
It reads one or more pathfiles that each define a closed polygon.
The pathfiles simply represent data point locations and the mask is set to the inside or outside value depending on whether a node is within a maximum distance from the nearest data point.
See full GMT (not the
GMT.jl
one) docs atgrdmask
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
A | steps :: [Type => Str | Number] $Arg = m|p|x|y$
If the input data are geographic then the sides in the polygons will be approximated by great circle arcs. When using this option sides will be regarded as straight lines.
C | clobber :: [Type => Str] $Arg = f|l|o|u$
Clobber mode: Selects the polygon whose z-value will determine the grid nodes.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdmask(....) form.
N | outedgein :: [Type => Str | List] $Arg = [z|Z|p|P]values$
Sets the out/edge/in that will be assigned to nodes that are outside the polygons, on the edge, or inside. Values can be any number, including the textstring NaN [Default is 0/0/1].
S | search_radius :: [Type => Str | List] $Arg = search_radius[unit] |xlim/ylim$
Set nodes to inside, on edge, or outside depending on their distance to the nearest data point.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
j | spherical_dist | spherical :: [Type => Str] $Arg = e|f|g$
Determine how spherical distances are calculated in modules that support this.
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
x | cores | n_threads :: [Type => Str or Number] $Arg = [[-]n]$
Limit the number of cores to be used in any OpenMP-enabled multi-threaded algorithms. (http://docs.generic-mapping-tools.org/latest/gmt.html#x-full)
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? grdmask$
GMT.grdmath
— Methodgrdmath(cmd::String, args...)
Call grdmath with all commands in a single string 'cmd'. This is not useful in itself as compared to call gmt("grdmath ....") but it's very useful in 'movie' because it can generate shell scripts from the julai command
See full GMT (not the GMT.jl
one) docs at grdmath
GMT.grdpaste
— Methodgrdpaste(cmd0::String="", G1=nothing, G2=nothing, kwargs...)
Combine grids $grid1$ and $grid2$ into $grid3$ by pasting them together along their common edge. Both grids must have the same dx, dy and have one edge in common.
See full GMT (not the GMT.jl
one) docs at grdpaste
Parameters
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdpaste(....) form.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
To see the full documentation type: $@? grdpaste$
GMT.grdproject
— Methodgrdproject(cmd0::String="", arg1=nothing, kwargs...)
Project a geographical gridded data set onto a rectangular grid or do the inverse projection.
See full GMT (not the GMT.jl
one) docs at grdproject
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
C | center :: [Type => Str | []] $Arg = [dx/dy]$
Let projected coordinates be relative to projection center [Default is relative to lower left corner].
D | inc :: [Type => Str | number] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]$
Set the grid spacing for the new grid. Append m for arc minute, s for arc second.
E | dpi :: [Type => Number]
Set the resolution for the new grid in dots per inch.
F | one2one :: [Type => Str] $Arg = [c|i|p|e|f|k|M|n|u]$
Force 1:1 scaling, i.e., output (or input, see -I) data are in actual projected meters [e].
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdproject(....) form.
I | inverse :: [Type => Bool]
Do the Inverse transformation, from rectangular to geographical.
M | projected_unit :: [Type => Str] $Arg = c|i|p$
Append c, i, or p to indicate that cm, inch, or point should be the projected measure unit.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
To see the full documentation type: $@? grdproject$
GMT.grdrotater
— Methodgrdrotater(cmd0::String="", arg1=nothing; kwargs...)
Takes a geographical grid and reconstructs it given total reconstruction rotations.
See full GMT (not the GMT.jl
one) docs at grdrotater
Parameters
A | rot_region :: [Type => Str | Tuple | Vec]
Specify directly the region of the rotated grid.
D | rot_outline :: [Type => Bool or Str] $Arg = true | filename$
Name of the grid polygon outline file. This represents the outline of the grid reconstructed to the specified time.
F | rot_polyg | rot_polygon :: [Type => Str | GMTdaset | Mx2 array] $Arg = filename | dataset)$
Specify a multisegment closed polygon file that describes the inside area of the grid that should be rotated.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdrotater(....) form.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
T | ages :: [Type => Str | Tuple]
Sets the desired reconstruction times. For a single time append the desired time. (http://docs.generic-mapping-tools.org/latest/grdrotater.html#t)
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
Example
G = grdmath("-R-5/5/-5/5 -I0.1 -fg X Y HYPOT");
tri = [-2.411 -1.629; -0.124 2.601; 2.201 -1.629; -2.410 -1.629];
Gr, tri_rot = grdrotater(G, rotation="-40.8/32.8/-12.9", rot_outline=true, rot_polygon=tri);
imshow(Gr, plot=(data=tri_rot,))
GMT.grdsample
— Methodgrdsample(cmd0::String="", arg1=nothing, kwargs...)
Reads a grid file and interpolates it to create a new grid file with either: a different registration; or a new grid-spacing or number of nodes, and perhaps also a new sub-region
See full GMT (not the GMT.jl
one) docs at grdsample
Parameters
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdsample(....) form.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
T | toggle :: [Type => Bool]
Toggle the node registration for the output grid so as to become the opposite of the input grid
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
x | cores | n_threads :: [Type => Str or Number] $Arg = [[-]n]$
Limit the number of cores to be used in any OpenMP-enabled multi-threaded algorithms. (http://docs.generic-mapping-tools.org/latest/gmt.html#x-full)
To see the full documentation type: $@? grdsample$
GMT.grdtrack
— Functiongrdtrack(cmd0::String="", arg1=nothing, arg2=nothing; kwargs...)
Interpolates the grid(s) at the positions in the table and returns the table with the interpolated values added as (one or more) new columns.
See full GMT (not the GMT.jl
one) docs at grdtrack
Parameters
A | interp_path | resample :: [Type => Str]
Arg = f|p|m|r|R[+l]
For track resampling (if
crossprofile
orprofile
are set) we can select how this is to be performed.C | crossprofile :: [Type => Str]
Arg = length/ds[/spacing][+a|+v][l|r]
Use input line segments to create an equidistant and (optionally) equally-spaced set of crossing profiles along which we sample the grid(s)
D | dfile :: [Type => Str]
In concert with
crossprofile
we can save the (possibly resampled) original lines to the file dfileE | profile :: [Type => Str]
Instead of reading input track coordinates, specify profiles via coordinates and modifiers.
F | critical :: [Type => Str]
Find critical points along each cross-profile as a function of along-track distance. Requires
crossprofile
and a single input grid.G | grid :: [Type => Str | GMTgrid | Tuple(GMTgrid's)]
N | no_skip | noskip :: [Type => Bool]
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | stack :: [Type => Str]
T | radius :: [Type => Number, Str | []]
Z | z_only :: [Type => Bool]
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
s | skiprows | skip_NaN :: [Type => Str] $Arg = [cols][a|r]$
Suppress output for records whose z-value equals NaN.
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
When using two numeric inputs and no G option, the order of the x,y and grid is not important. That is, both of this will work: $D = grdtrack([0 0], G);$ or $D = grdtrack(G, [0 0]);$
To see the full documentation type: $@? grdtrack$
GMT.grdtrend
— Functiongrdtrend(cmd0::String="", arg1=nothing, arg2=nothing; kwargs...)
reads a 2-D grid file and fits a low-order polynomial trend to these data by [optionally weighted] least-squares.
See full GMT (not the GMT.jl
one) docs at grdtrend
Parameters
N | model :: [Type => Str | Number]
Sets the number of model parameters to fit.
D | diff :: [Type => Str | []]
Compute the difference (input data - trend). Optionaly provide a file name to save result on disk.
T | trend :: [Type => Str | []]
Compute the trend surface. Optionaly provide a file name to save result on disk.
W | weights :: [Type => Str]
If weight.nc exists, it will be read and used to solve a weighted least-squares problem.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
To see the full documentation type: $@? grdtrend$
GMT.grdvector
— Methodgrdvector(arg1, arg2, kwargs...)
Takes two 2-D grid files which represents the x- and y-components of a vector field and produces a vector field plot by drawing vectors with orientation and length according to the information in the files. Alternatively, polar coordinate r, theta grids may be given instead.
See full GMT (not the GMT.jl
one) docs at grdvector
Parameters
A | polar :: [Type => Bool]
The grid contain polar (r, theta) components instead of Cartesian (x, y) [Default is Cartesian components].
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
G | fill :: [Type => Str | Number]
Sets color or shade for vector interiors [Default is no fill].
I | inc | increment | spacing :: [Type => Sytr | Number] $Arg=[x]dx[/dy]$
Only plot vectors at nodes every xinc, yinc apart (must be multiples of original grid spacing).
maxlen :: [Type => Number]
Set the maximum length in plot units that an arrow will have. By default it's equal to fig width / 20.
This option is ignored if **inc** is set.
N | noclip | no_clip :: [Type => Bool]
Do NOT clip symbols that fall outside map border
Q | vec | vector | arrow :: [Type => Str]
Modify vector parameters. For vector heads, append vector head size [Default is 0, i.e., stick-plot].
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | vscale | vec_scale :: [Type => Str | Number] $Arg = [i|l]scale[unit]$
Sets scale for vector plot length in data units per plot distance measurement unit [1].
T | sign_scale :: [Type => Bool]
Means the azimuths of Cartesian data sets should be adjusted according to the signs of the scales in the x- and y-directions [Leave alone].
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | pen :: [Type => Str | Number]
Sets the attributes for the particular line.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
Z | azimuth :: [Type => Bool]
The theta grid provided contains azimuths rather than directions (implies -A).
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
To see the full documentation type: $@? grdvector$
GMT.grdview
— Methodgrdview(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; kwargs...)
Reads a 2-D grid and produces a 3-D perspective plot by drawing a mesh, painting a colored/grayshaded surface made up of polygons, or by scanline conversion of these polygons to a raster image.
See full GMT (not the GMT.jl
one) docs at grdview
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
Jz | zscale | zsize :: [Type => String]
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
G | drape | drapefile :: [Type => Str | GMTgrid | a Tuple with 3 GMTgrid types]
Drape the image in drapefile on top of the relief provided by relief_file.
I | shade | shading | intensity :: [Type => Str | GMTgrid] $Arg = GMTgrid | filename$
Gives the name of a grid file or GMTgrid with intensities in the (-1,+1) range, or a grdgradient shading flags.
N | plane :: [Type => Str | Int] $Arg = (level [,fill])$
Draws a plane at this z-level.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | surftype | surf :: [Type => Str | Int] $Arg = mesh=Bool, surface=Bool, image=Bool, wterfall=(:rows|cols,[fill])$
Specify m for mesh plot, s for surface, i for image.
S | smoothfactor :: [Type => Number]
Used to resample the contour lines at roughly every (gridbox_size/smoothfactor) interval..
T | tiles | no_interp :: [Type => Str | NT] $Arg = (skip|skip_nan=Bool, outlines=Bool|pen)$
Plot image without any interpolation.
W | pens | pen :: [Type => Str] $Arg = (contour=Bool|pen, mesh=Bool|pen, facade=Bool|pen)$
Draw contour, mesh or facade. Append pen attributes.
isgeog :: [Type => Any]
When drapping an image that has projection info over a grid that is in geographics but does not carry any information about this fact we may need to use this option to help the program finding the common BoundingBox.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? grdview$
GMT.grdvolume
— Functiongrdvolume(cmd0::String="", arg1=nothing, kwargs...)
Reads one 2-D grid and returns xyz-triplets.
See full GMT (not the GMT.jl
one) docs at grdvolume
Parameters
C | cont | contour :: [Type => Str | List] $Arg = cval or low/high/delta or rlow/high or rcval$
Find area, volume and mean height (volume/area) inside the cval contour.
L | base_level :: [Type => Number] $Arg = base$
Also add in the volume from the level of the contour down to base [Default base is contour].
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | unit :: [Type => Str] $Arg = e|f|k|M|n|u$
For geographical grids, append a unit from e|f|k|M|n|u [Default is meter (e)].
T :: [Type => Str] $Arg = [c|h]$
Determine the single contour that maximized the average height (= volume/area).
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
Z | scale :: [Type => Str or List] $Arg = fact[/shift]$
Optionally subtract shift before scaling data by fact. [Default is no scaling].
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
To see the full documentation type: $@? grdvolume$
GMT.greenspline
— Methodgreenspline(cmd0::String="", arg1=nothing; kwargs...)
Reads randomly-spaced (x,y,z) triples and produces a binary grid file of gridded values z(x,y) by solving:
(1 - T) * L (L (z)) + T * L (z) = 0
See full GMT (not the GMT.jl
one) docs at greenspline
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
I | inc :: [Type => Str | Number]
x_inc [and optionally y_inc] is the grid spacing.
A | gradient :: [Type => Str | Array] $Arg = gradfile+f1|2|3|4|5 | (data=Array, format=x)$
The solution will partly be constrained by surface gradients v = v*n, where v is the gradient magnitude and n its unit vector direction.
C | approx | approximate :: [Type => Str | Number] $Arg = [n]value[+ffile]$
Find an approximate surface fit: Solve the linear system for the spline coefficients by SVD and eliminate the contribution from all eigenvalues whose ratio to the largest eigenvalue is less than value.
G | grid :: [Type => Str | []]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = greenspline(....) form.
D | metadata | mode :: [Type => Number]
Sets the distance flag that determines how we calculate distances between data points.
E :|misfit :: [Type => Str | []] $Arg = [misfitfile]$
Evaluate the spline exactly at the input data locations and report statistics of the misfit (mean, standard deviation, and rms).
L | leave_trend :: [Type => Bool]
Do not remove a linear (1-D) or planer (2-D) trend when -D selects mode 0-3.
N | nodes :: [Type => Number | Array] $Arg = nodefile$
ASCII file with coordinates of desired output locations x in the first column(s).
Q | dir_derivative :: [Type => Str] $Arg = az|x/y/z$
Rather than evaluate the surface, take the directional derivative in the az azimuth and return the magnitude of this derivative instead.
S | splines :: [Type => Str] $Arg = c|t|l|r|p|q[pars]$
Select one of six different splines. The first two are used for 1-D, 2-D, or 3-D Cartesian splines.
T | mask :: [Type => Str] $Arg = maskgrid$
For 2-D interpolation only. Only evaluate the solution at the nodes in the maskgrid that are not equal to NaN.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | uncertainties :: [Type => Str | []] $Arg = [w]$
Data one-sigma uncertainties are provided in the last column. We then compute weights that
are inversely proportional to the uncertainties squared.
Z | mode | distmode :: [Type => Str | number]
Sets the distance mode that determines how we calculate distances between data points.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
x | cores | n_threads :: [Type => Str or Number] $Arg = [[-]n]$
Limit the number of cores to be used in any OpenMP-enabled multi-threaded algorithms. (http://docs.generic-mapping-tools.org/latest/gmt.html#x-full)
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? greenspline$
GMT.grid2img
— MethodI = grid2img(G::GMTgrid{<:Unsigned})
Converts a GMTgrid of type Unsigned into a GMTimage. Data array is not copied nor its type is changed.
GMT.gridit
— FunctionG = gridit(fname="", indata=nothing; method="surface", gdopts="", proj="", epsg=0, kw...)
Wrapper function to interpolate scattered data into a grid. Interpolation methods may be those of GMT and GDAL (gdal_grid).
Parameters
fname
: A file name containing the source dataset to be interpolated. It must contain at least 3 columns (x y z).indata
: Alternative source dataset in the form of a GMTdataset, a Mx3 matrix or a GDAL dataset.method
: The interpolation method name. One of (GMT): "surface" or "minimum curvature", "triangulate", "nearneighbor", "sphtriangulate", "greenspline". The arguments: "mean", "median", "mode", "std", "highest", "lowest" will compute those amounts inside each rectangular cell.- Or (GDAL): "invdist", "invdistnn", "average", "nearest", "linear", "minimum", "maximum", "range",
"count", "averagedistance", "averagedistancepts". See https://gdal.org/programs/gdalgrid.html#gdal-grid
- Note that there is some overlap between the diverse methods. For example, the GMT's $nearneighbor$
and GDAL's $invdist$ apply the same algorithm (the Inverse Distance Weight) but they difer on how to select the points to do the weighted average.
gdopts
: List of options, in the form of a single string, accepted by the gdal_grid utility. This option only applies to the GDAL methods.proj
: An optional proj4 string describing the data's coordinate system. Note that this not imply any data projection. The input data may itself already carry this information, case in which this option is not necessary.wkt
: An optional wkt string describing the data's coordinate system. Same comments asproj
epsg
: An optional epsg code describing the data's coordinate system. Same comments asproj
Kwargs
kw...
keyword=value arguments. These are used to pass options that are specific to a particular GMT interpolation methods. The user must consult individual manual pages to learn about the available possibilities. Two very important (actually, mandatory) options are theregion=...
and theinc=...
that select the grid limits and the grid resolution. However, if they are not provided (or only one of them is) we make a very crude estimate based on data limits and point density. But this should only be used for a very exploratory calculation.preproc
: This option only applies to themethod=:surface
and means that the data is previously passed through one of $block*$ modules to decimate the data in each cell as strongly advised by the $surface$ program.preproc=true
will use $blockmean$. To use any of the other two, pass its name as value. e.g.preproc="blockmedian"
.
Returns
A GMTgrid or nothing if file was writen on disk.
Example
G = gridit("@ship_15.txt", method=:surface, mask=0.3, preproc=true);
GMT.grp2idx
— Methodgidx, gnames = grp2idx(s::AbstracVector)
Creates an index Vector{Vector} from the grouping variable S. S can be an AbstracVector of elements for which the ==
method is defined. It returns a Vector of Vectors with the indices of the elements of each group. There will be as many groups as length(gidx)
. gnames
is a string vector holding the group names.
GMT.gunique
— Methodu, ind = gunique(x::AbstractVector; sorted=false)
Return an array containing only the unique elements of x
and the indices ind
such that u = x[ind]
. If sorted
is true the output is sorted (default is not)
u, ic, ia = gunique(x::AbstractMatrix; sorted::Bool=false, rows=true)
Behaves like Matlab's unique(x, 'rows'), where u = x(ia,:) and x = u(ic,:). If rows
is false then ic
is empty.
GMT.histogram
— Methodhistogram(cmd0::String="", arg1=nothing; kwargs...)
Examines the first data column to calculate histogram parameters based on the bin-width provided. Alternatively, show histograms of GMTimage & GMTgrid objects directly. The options 'auto=true' or 'thresholds=(0, 0.1)' will find the histogram bounds convenient for contrast enhancement (histogram stretch). The values represent the percentage of countings used to estimate the boundings. The option 'zoom=true' will set 'auto=true' and show histogram only on the region of interest.
See full GMT (not the GMT.jl
one) docs at pshistogram
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
A | horizontal :: [Type => Bool]
Plot the histogram horizontally from x = 0 [Default is vertically from y = 0].
Jz | zscale | zsize :: [Type => String]
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color | cmap :: [Type => Str | GMTcpt]
Give a CPT. The mid x-value for each bar is used to look-up the bar color.
D | annot | annotate | counts :: [Type => Str | Tuple]
Annotate each bar with the count it represents.
E | width :: [Type => Bool]
Arg = width[+ooffset]
Use an alternative histogram bar width than the default set via T, and optionally shift all bars by an offset.
binmethod | *BinMethod** :: [Type => Str]
Arg = method
Binning algorithm: "scott", "fd", "sturges" or "sqrt" for floating point data. "second", "minute", "hour", "day", "week", "month" or "year" for DateTime data.
F | center :: [Type => Bool]
Center bin on each value. [Default is left edge].
G | fill :: [Type => Number | Str]
Select filling of bars [if no G, L or C set G=100].
I | inquire | bins :: [Type => Bool | :O | :o | bins=(all=true,) | bins=(no_zero=true,) ]
Inquire about min/max x and y after binning OR output the binned array.
L | out_range :: [Type => Str]
Arg = l|h|b
Handling of extreme values that fall outside the range set by T.
N | distribution | normal :: [Type => Str]
Draw the equivalent normal distribution; append desired pen [0.5p,black].
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | cumulative :: [Type => Bool | "r"]
Draw a cumulative histogram. Append r to instead compute the reverse cumulative histogram.
R | region :: [Type => Str]
Specifies the ‘region’ of interest in (r,azimuth) space. r0 is 0, r1 is max length in units.
S | stairs :: [Type => Str | number]
Draws a stairs-step diagram which does not include the internal bars of the default histogram.
T | range | bin :: [Type => Str]
Arg = [min/max/]inc[+n] | file|list]
Make evenly spaced array of bin boundaries from min to max by inc. If min/max are not given then we default to the range in
region
. For constant bin width usebin=val
..W | pen :: [Type => Str | Tuple]
Set pen attributes for sector outline or rose plot. [Default is no outline].
Z | kind :: [Type => Number | Str]
Choose between 6 types of histograms.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? histogram$
GMT.hlines
— Functionhlines(arg; decorated=(...), xmin=NaN, xmax=NaN, percent=false, kwargs...)
Plots one or a collection of horizontal lines with eventual decorations
xmin
&xmax
: Limit the horizontal lines to start axmin
and/or end atxmax
percent
: If true thexmin
&xmax
are interpreted as fractions of the figure height.B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
W | pen | line_attrib :: [Type => Str]
Set pen attributes for the horizontal lines
Example:
plot(rand(5,3))
hlines!([0.2, 0.6], pen=(1, :red), show=true)
GMT.icosahedron
— FunctionFV = icosahedron(r=1.0)
Creates an icosahedron mesh with radius `r.
GMT.image
— Methodimage(cmd0::String="", arg1=nothing; kwargs...)
Place images or EPS files on maps.
See full GMT (not the GMT.jl
one) docs at psimage
Parameters
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
D | pos | position :: [Type => Str]
Sets reference point on the map for the image using one of four coordinate systems.
F | box :: [Type => Str | []]
Without further options, draws a rectangular border around the image using MAPFRAMEPEN.
G | bitcolor | bit_color | bit_bg|fg|alpha:: [Type => Str]
Change certain pixel values to another color or make them transparent.
I | invert :: [Type => Str | Number]
Invert 1-bit image before plotting.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
Jz | zscale | zsize :: [Type => String]
M | monochrome :: [Type => Bool]
Convert color image to monochrome grayshades using the (television) YIQ-transformation.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? image$
GMT.image_alpha!
— MethodI = image_alpha!(img::GMTimage; alpha_ind::Integer, alpha_vec::Vector{Integer}, alpha_band::UInt8, burn=false)
Change the alpha transparency of the GMTimage object img
. If the image is indexed, one can either change just the color index that will be made transparent by using alpha_ind=n
or provide a vector of transaparency values in the range [0 255]; This vector can be shorter than the orginal number of colors. Use alpha_band
to change, or add, the alpha of true color images (RGB).
burn
: The background color to be used in the compositing. It can be a 3-tuple of integers in the range [0 255] or a symbol or string that will a color name. e.g.,bg=:blue
. The default is:white
. This option is only usable for true color images andalpha_band
. Then instead of adding the alpha band, that band is used to replace or compose (when the alpha_band values are variable to other than 0 or 255) the background color.
Examples
# Example1: change to the third color in cmap to represent the new transparent color
julia> image_alpha!(img, alpha_ind=3)
#Example2: change to the first 6 colors in cmap by assigning them random values
julia> image_alpha!(img, alpha_vec=round.(Int32,rand(6).*255))
# Burn the red color in a random image
julia> img = mat2img(rand(UInt8, 750, 750, 3));
julia> mask = rand(Bool, 750, 750);
julia> image_alpha!(img, alpha_band=mask, burn=:red);
GMT.image_cpt!
— Methodimage_cpt!(img::GMTimage, cpt::GMTcpt, clear=false)
or
image_cpt!(img::GMTimage, cpt::String, clear=false)
Add (or replace) a colormap to a GMTimage object from the colors in the cpt. This should have effect only if IMG is indexed. Use image_cpt!(img, clear=true)
to remove a previously existant colormap
field in IMG
GMT.imagesc
— MethodI = imagesc(mat; x=, y=, hdr=, proj4=, wkt=, GI=, clim=, cmap=, kw...)
imagesc takes a Float matrix or a GMTgrid type and scales it (by default) to the [0, 255] interval. In the process it creates a GMTimage type. Those types can account for coordinates and projection information, hence the optional arguments. Contrary to its Matlab cousin, it doesn't display the result (that we easily do with imshow(mat)
) but return instead a GMTimage object.
clim
: Specify clims as a two-element vector of the form [cmin cmax], where values of the scaled image less than or equal to cmin are assigned that value. The same goes for cmax.cmap
: If provided,cmap
is a GMTcpt and its contents is converted to theGMTimage
colormap.GI
: This can be either a GMTgrid or a GMTimage and its contents is used to set spatial contents (x,y coordinates) and projection info that one may attach to the created image result. This is a handy alterative to thex=, y=, proj4=...
options.stretch
: This option is indicated to select an interval of the range of thez
values and use only those to scale to the [0 255] interval. Astretch=true
automatically determines good values for histogram stretching via a call tohistogram
. The formstretch=(zmin,zmax)
allows specifying the input limits directly. A previous plot of $histogram(mat, show=true)$ can help determine good values. Note that when this optionstretch
is used, ALL OTHER options are ignored. See also the $rescale$ function.
If 'mat' is instead a UInt16 GMTimage type we call rescale(I, stretch=true, type=UInt8)
instead of issuing an error. In this case clim
can be a two elements vector to specify the desired stretch range. The default is to let histogram
guess these values.
GMT.img2grid
— MethodG = img2grid(I::GMTimage; type=eltype(I.image))
Converts an GMTimage object to a grid. If the type
option is not set the image data type is preserved and the array in NOT copied. Otherwise the image data is converted to the specified type and a copy is made.
GMT.imshow
— Functionimshow(arg1; kw...)
Is a simple front end to the grdimage
grdview
programs that accepts GMTgrid, GMTimage, 2D array of floats or strings with file names of grids or images. The normal options of the grdimage and grdview programs also apply here but some clever guessing of suitable necessary parameters is done if they are not provided. Contrary to other image producing modules the "show' keyword is not necessary to display the image. Here it is set by default. If user wants to use imshow to create layers of a more complex fig he can use show=false for the intermediate layers.
This module uses an internal logic to decide whether use grdimge
, grdview
or plot
. Namely, when the view
option is used grdview
is choosed and a default vertical scale is assigned. However, sometimes we want a rotated plot, optionally tilted, but not 3D view. In that case use the option flat=true
, which forces the use of grdimage
.
Examples
# Plot vertical shaded illuminated view of the Mexican hat
julia> G = gmt("grdmath -R-15/15/-15/15 -I0.3 X Y HYPOT DUP 2 MUL PI MUL 8 DIV COS EXCH NEG 10 DIV EXP MUL =");
julia> imshow(G, shade="+a45")
# Same as above but add automatic contours
julia> imshow(G, shade="+a45", contour=true)
# Plot a random heat map
julia> imshow(rand(128,128))
# Display a web downloaded jpeg image wrapped into a sinusoidal projection
julia> imshow(gmtread()"http://larryfire.files.wordpress.com/2009/07/untooned_jessicarabbit.jpg"), region=:global, frame="g", proj=:sinu)
# Plot images in the walls of the cube for the 3D view cases. Replace file names with those that exist for you.
julia> viz(G, zsize=6, facades=("cenora_base.jpg", "bunny_cenora.webp", "burro_cenora.webp"))
GMT.inbbox
— Methodinout = inbbox(x::Real, y::Real, bbox) -> Bool
Find out if points x,y
are inside a bounding box.
x, y
: point coordinates.bbox
is a 4-element array (vector, matrix or tuple) with xmin, xmax, ymin, ymax.
Returns
true
for points inside the bounding box and false
for those outside
GMT.ind2rgb
— FunctionI = ind2rgb(I::GMTimage, cpt::GMTcpt=GMTcpt(), layout="BRPa"; cmap=GMTcpt())
Convert an indexed image I to RGB. If cmap
is not provided, it uses the internal colormap to do the conversion. If neither them exists, the layer is replicated 3 times thus resulting in a gray scale image.
Use the cmap
keyword in alternative to the cpt
positional variable.
GMT.info
— Functioninfo(GI, showdata::Bool=true; data=true, full=false, crs::Bool=false)
Shows information about the GI
grid or image that includes dimensional and, if exists, referencing data.
showdata
: Boolean that controls if a small array subset is printed or not. Alternatively, usedata=false
as a synonym for not showing the data array.crs
: Boolean that iftrue
only prints the referencing information.full
: For grids print also some more type metadata (var names, etc).
info(D::GDtype; crs::Bool=false, attribs=false, att="")
Shows information about the D
GMTdataset (or vector of them).
crs
: Boolean that iftrue
only prints the referencing information.attribs
: In case the dataset has attributes, like they do when resulting from reading a shape file, use this parameter to print only the attribute table. A setting ofattribs=true
will print the entire attributes table. Give a positive number, e.g.attribs=5
to show only the first 5 attributes. A negative number prints the last n attribs. A vector range,attribs=5:9
is also accepted.att
: Name of one attribute. Returns a string vector with the values of the attribute passed into this option. Example, $attn = info(D, att="NAME")$ returns all values of the attribute $NAME$.
info(any)
Runs $show(stdout, "text/plain", any)$ which prints all elements of any
. Good for printing the entire vector or matrix.
GMT.inpolygon
— Methodin = inpolygon(x, y, polygon)
or
in = inpolygon(point, polygon)
Returns in
indicating if the query points specified by x
and y
are inside of the polygon area defined by:
polygon
: a GMTdatset defining the polygon or a Mx2 matrix of reals that should have the first and last elements equal.point
: a Mx2 matrix or a two elements vector with the x and y point coordinates. Depending on the number of query points inpoint
, we return either an $Int$ or a $Vector{Int}$.
Returns:
- in = 1
- on = 0
- out = -1
Reference
GMT.interp_vec
— Methodfrac = interp_vec(x, val) -> Float64
Returns the positional fraction that val
ocupies in the x
vector
GMT.interp_vslice
— MethodGi = interp_vslice(G::GMTgrid; inc=0.0) -> GMTgrid
Linearly interpolated the grid G
along the "columns" (y coordinates). Normally G
is a grid resulting from a cube vertical slice where not uncomonly the resulting grid is not regular (cube layers are not equi-spaced).
G
: A GMTgrid object with the grid to be interpolatedinc
: The interpolation increment. If == 0.0 andG.y
is a constant spacing vector, nothing is done. Otherwise, but still in the == 0.0 case, the grid interpolated with a pace equal to the minimumG.y
spacing. Ainc > 0.0
means the grid is interpolated at that increment.
GMT.intlut
— Methodintlut(I, lut)
Creates an array containing new values of I
based on the lookup table, lut
. I
can be a GMTimage or an uint matrix. The types of I
and lut
must be the same and the number of elements of lut
is eaqual to intmax of that type. E.g. if eltype(lut) == UInt8 then it must contain 256 elements.
Returns
An object of the same type as I
GMT.invgeod
— Methoddist, az1, az2 = invgeod(lonlat1::Vector{<:Real}, lonlat2::Vector{<:Real}; proj::String="",
s_srs::String="", epsg::Integer=0, backward=false)
Solve the inverse geodesic problem.
Args:
lonlat1
: - coordinates of point 1 in the given projection (or a matrix with several points).lonlat2
: - coordinates of point 2 in the given projection (or a matrix with same size aslonlat1
).proj
ors_srs
: - the given projection whose ellipsoid we move along. Can be a proj4 string or an WKT.epsg
: - Alternative way of specifying the projection [Default is WGS84].backward
: - Iftrue
, return backard azimuths.
Returns
dist - A scalar with the distance between point 1 and point 2 (meters). Or a vector when lonlat1|2 have more than one pair of points.
az1 - azimuth at point 1 (degrees) ∈ [-180, 180)
az2 - (forward) azimuth at point 2 (degrees) ∈ [-180, 180)
Remarks:
If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = 90 +/- eps, and taking the limit as eps -> 0+.
GMT.inwhichpolygon
— Methodids = inwhichpolygon(point::Matrix{Real}, D::Vector{GMTdataset}; on_is_in=false, pack=false)
or
ids = inwhichpolygon(x, y, D::Vector{GMTdataset}; on_is_in=false, pack=false)
Finds the IDs of the polygons enclosing the query points in point
. Each row in the matrix point
contains the coordinates of a query point. Query points that don't fall in any polygon get an ID = 0. Returns either an $Int$ or a $Vector{Int}$ depending on the number of input query points.
D
: A Vector of GMTdadaset defining the polygons.point
: A Mx2 matrix or a two elements vector with the x and y point coordinates.x, y
: Specifies the x-coordinates and y-coordinates of 2-D query points as separate vectors (or two scalars).on_is_in
: Ifon_is_in=true
then points exactly on the border are considered inside. Default isfalse
.pack
: Ifpack=true
then a vector of vectors is returned with the IDs of the hit polygons and the indices of the query points that hit each polygon. That is: ids[1] contains indices ofD
that recieved at least a hit; ids[2] contains the indices of the querypoint
that hit the polygon D[ids[1]], etc.
Example:
pts = [[1 2 3;1 2 3;1 2 3][:] [1 1 1;2 2 2; 3 3 3][:]];
D = triplot(pts, noplot=true);
points = [2.4 1.2; 1.4 1.4];
ids = inwhichpolygon(points, D);
# Plot the triangulation and the query points.
plot(D)
plot!(D[ids[1]], fill=:grey)
plot!(D[ids[2]], fill=:green)
plot!(points, marker=:star, ms="12p", fill=:blue, show=true)
GMT.isFV
— MethodisFV(D)::Bool
Check if D is a Face-Vertices ensemble (a 2 elements vector of GMTdataset).
GMT.is_stored_transposed
— Methodis_stored_transposed(GI::GItype) -> Bool
Return true if the data in the GMTgrid or GMTimage GI
is stored transposed or false otherwise. See more details in the comments of the gmt2gd
function.
GMT.isgeog
— Methodisgeog(in)::Bool
Find if the input (a GMTgrid, GMTimage, GMTdadaset or string), if referenced, is in geographical coordinates.
GMT.isnodata
— Functionisnodata(array::AbstractArray, val=0)
Return a boolean array with the same size a array
with 1's (true
) where $array[i] == val$. Test with an image have shown that this function was 5x faster than $ind = (I.image .== 0)$
GMT.iso3to2_world
— Methodd = iso3to2_world()
Creates a Dictionary that maps WORLD country code names from ISO3166A3 (3 chars) to ISO3166A2 (2 chars)
It has 250 contry names.
GMT.isodata
— Methodlevel = isodata(I::GMTimage; band=1) -> Int
isodata
Computes global image threshold using iterative isodata method that can be used to convert an intensity image to a binary image with `binarize
. level
is a normalized intensity value that lies in the range [0 255]. This iterative technique for choosing a threshold was developed by Ridler and Calvard. The histogram is initially segmented into two parts using a starting threshold value such as 0 = 2B-1, half the maximum dynamic range. The sample mean (mf,0) of the gray values associated with the foreground pixels and the sample mean (mb,0) of the gray values associated with the background pixels are computed. A new threshold value 1 is now computed as the average of these two sample means. The process is repeated, based upon the new threshold, until the threshold value does not change any more.
Originaly from MATLAB http://www.mathworks.com/matlabcentral/fileexchange/3195 (BSD, Licenced)
GMT.isometric2geod
— Methodlat = isometric2geod(latin, flat)
Convert isometric latitudes to geodetic latitudes.
Arguments
latin
: Isometric latitude(s) in degreesflat
: Flattening of the ellipsoid (use 0.0 for is spherical).
Returns
- Geodetic latitude(s) in degrees
GMT.isvector
— Methodisvector(x)::Bool
Return true if x is a vector in the Matlab sense.
GMT.kde2grid
— MethodG = kde2grid(arg)
Wrap a KernelDensity
object to a GMTgrid
GMT.kmeans
— FunctionIk = kmeans(I::GMTimage, k=5; seeds=nothing, maxiter=100, tol=1e-7, V=false) -> GMTimage
Compute a k-means clustering on an RGB image I
. It produces a fixed number of clusters, each associated with a center, and each RGB color is assigned to a cluster with the nearest center.
I
: The input $GMTimage$ object.k
: The number of clusters when using unsupervised classification.seeds
: For supervised classifications this is Mx3 UInt8 matrix with the colors of the cluster centers. The algorithm than aggregates all colors in the image around these M seed colors. Attention, if provided, this option resetsk
.maxiter
: Maximum number of iterations that the algorithm may run till reach a solution.tol
: Alternatively, sets the minimal allowed change of the objective during convergence. The iteration process stops when one of the two conditions is met first.V
: Print some info at the end of the iterative loop (number of iterations, time spent).
kmeans(X::Union{GMTdataset, Matrix{<:Real}}, k=3; seeds=nothing, maxiter=100, tol=1e-7,
raw::Bool=false, V=false) -> Vector{GMTdataset} | idx, centers, counts
This method accepts a M-by-d matrix or a $GMTdataset$ where columns represent the data points and rows the d
-dimensional data point.
raw
: A Boolean that iffalse
makes the return data be a vector of $GMTdatset$, one for each cluster found in input data. Ifraw=true
, we return:idx, centers, counts
, whereidx
: A vector of ints with the assignments of each data points (by position in theidx
vector) to clusters.centers
: A k-by-d matrix with the centers of each cluster.counts
: A matrix of integers with the cluster number in first column, and number of elements in that cluster in second column.
Example
D = gmtread(GMT.TESTSDIR * "iris.dat");
Dk = kmeans(D, k=3) # Unsupervised segment data into 3 clusters.
GMT.kml2gmt
— Functionkml2gmt(cmd0::String="", arg1=nothing, kwargs...)
kml2gmt - Extract GMT table data from Google Earth KML files
See full GMT (not the GMT.jl
one) docs at kml2gmt
Parameters
F | feature_type :: [Type => Str] $Arg = s|l|p$
Specify a particular feature type to output. Choose from points (s), line (l), or polygon (p). By default we output all geometries.
Z | altitudes :: [Type => Bool]
Output the altitude coordinates as GMT z coordinates [Default will output just longitude and latitude]. (http://docs.generic-mapping-tools.org/latest/kml2gmt.html#z)
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
do | nodata_out :: [Type => Str or Number] $Arg = nodata$
Examine all output columns and if any item equals NAN substitute it with the chosen missing data value.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? kml2gmt$
GMT.legend
— Functionlegend(cmd0::String="", arg1=nothing; kwargs...)
Make legends that can be overlaid on maps. It reads specific legend-related information from input or file file.
See full GMT (not the GMT.jl
one) docs at legend
Parameters
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
C | clearance :: [Type => Str]
Sets the clearance between the legend frame and the internal items [4p/4p].
D | pos | position :: [Type => Str]
Arg=[g|j|J|n|x]refpoint+wwidth[/height][+jjustify][+lspacing][+odx[/dy]]
Defines the reference point on the map for the legend using one of four coordinate systems.
F | box :: [Type => Str | Number]
Arg=[+cclearances][+gfill][+i[[gap/]pen]][+p[pen]][+r[radius]][+s[[dx/dy/][shade]]]
Without further options, draws a rectangular border around the legend using MAPFRAMEPEN.
M | source :: [Type => Bool]
Modern mode only:
S | scale :: [Type => Number]
Scale all symbol sizes by a common scale
T | leg_file :: [Type => Str]
Modern mode only: Write hidden legend specification file to fname.
Jz | zscale | zsize :: [Type => String]
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
q | inrow | inrows :: [Type => Str] $Arg = [i|o][~]rows[+ccol][+a|f|s]$
Select specific data rows to be read (-qi [Default]) or written (-qo) [all].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? legend$
GMT.lelandshade
— Method[I = ] lelandshade(G::GMTgrid; detail=1.0, contrast=2.0, intensity=false, zfactor=3, transparency=0.6,
show=false, color=false, opts=String[], cmap="", kw...)
Compute a grayscale or color shaded illumination image using the thechnique developed by Leland Brown's "texture shading"
G
: A $GMTgrid$ or a grid file name from which to compute the Leland texture illumination image.detail
is the amount of texture detail. Lower values of detail retain more elevation information, giving more sense of the overall, large structures and elevation trends in the terrain, at the expense of fine texture detail. Higher detail enhances the texture but gives an overall "flatter" general appearance, with elevation changes and large structure less apparent.contrast
is a parameter called “vertical enhancement.” Higher numbers increase contrast in the midtones, but may lose detail in the lightest and darkest features. Lower numbers highlight only the sharpest ridges and deepest canyons but reduce contrast overall.intensity | uint16
controls if output is a UInt16 or a UInt8 image (the default). Note that the original code writes only UInt16 images but if we want to combine this with the hillshade computed with $gdaldem$, a UInt8 image is more handy.zfactor
: A terrain amplification factor used in $gdaldem$ when computing the "hillshade"transparency
: The transparency of the texture image computed with the Leland algorithm when blended with hillshade computed with $gdaldem$. The default value, 0.5, gives equal weight to both images. A value of 0.75 will make the texture image weight 3/4 of the total sum, and so forth.color
: Boolean that selects if the output is a color or a grayscale image (the default). For color images we create a default linear color map (via a call to $makecpt$), but this can be overruled with thecmap
option.equalize
: For color images one may select to histogram equalize the colors (via a call to $grd2cpt$). This option alone (as well ascmap
) also setscolor=true
.opts
: A (optional) string vector with $gdaldem$ dedicated options (see its man mage). Use this to fine tune the "hillshade" part of the final image.cmap
: When doing color images and don't want the default cmap, pass a color map (cpt) name (file or master cpt name) or $GMTcpt$. This also setscolor=true
.colorbar
: Boolean, used only whenshow=true
, to add a colorbar on the right side of the image.show
: Boolean that if set totrue
will show the result immediately. Iffalse
, a $GMTimage$ object is returned.kw
: The keword/value pairs that can be used to pass arguments to $makecpt$, $grd2cpt$ and $gdaldem$.
Examples:
lelandshade(gmtread("@earth_relief_01s", region=(-114,-113,35,36)), color=true, colorbar=true, show=true)
Returns
A GMTimage object (8 or 16 bits depending on the intensity
option) if show == false, or nothing otherwise.
GMT.linearfitxy
— Methodlinearfitxy(X, Y; σX=0, σY=0, r=0, ci=95)
Performs 1D linear fitting of experimental data with uncertainties in X and Y:
- Linear fit:
Y = a + b*X
[1] - Errors: $X ± σX; Y ± σY$ [2]
- Errors' correlation: $r = = cov(σX, σY) / (σX * σY)$ [3]
Arguments:
X
andY
are input data vectors with length ≥ 3- Optional standard deviation errors $σX$ and $σY$ are vectors or scalars
- Optional
r
is the correlation between the $σX$ and $σY$ errors.r
can be a vector or scalar ci
is the confidence interval for the statistics. By default it's 95% but any integer number > 0 < 100 will do.
$σX$ and $σY$ errors (error ellipses) with bivariate Gaussian distribution assumed. If no errors, or if only $σX$ or $σY$ are provided, then the results are equivalent to those from the LsqFit.jl package.
Based on York et al. (2004) with extensions (confidence intervals, diluted corr. coeff.).
Examples:
D = linearfitxy(X, Y) # no errors in X and Y, no plot displayed
D = linearfitxy(X, Y; σX, σY) # XY errors not correlated (r=0);
D = linearfitxy([91., 104, 107, 107, 106, 100, 92, 92, 105, 108], [9.8, 7.4, 7.9, 8.3, 8.3, 9.0, 9.7, 8.8, 7.6, 6.9]);
D = linearfitxy([0.0, 0.9, 1.8, 2.6, 3.3, 4.4, 5.2, 6.1, 6.5, 7.4], [5.9, 5.4, 4.4, 4.6, 3.5, 3.7, 2.8, 2.8, 2.4, 1.5], sx=1 ./ sqrt.([1000., 1000, 500, 800, 200, 80, 60, 20, 1.8, 1]), sy=1 ./ sqrt.([1., 1.8, 4, 8, 20, 20, 70, 70, 100, 500]));
D = linearfitxy([0.037 0.0080; 0.035 0.0084; 0.032 0.0100; 0.040 0.0085; 0.013 0.0270; 0.038 0.0071; 0.042 0.0043; 0.030 0.0160], sx=0.03, sy=0.1, r=0.7071);
The results are added as new columns of a GMTdataset structure when they are vectors (σX σY r
) and stored as attributes when they are scalars (a
, b
, σa
, σb
, σa95
, σb95
, ρ
and S
):
- The intercept
a
, the slopeb
and their uncertaintiesσa
andσb
- $σa95$ and $σb95$: 95%-confidence interval using two-tailed t-Student distribution, e.g.: $b ± σb95 = b ± t(0.975,N-2)*σb$
- Goodness of fit
S
(reduced $Χ²$ test): quantity with $Χ²$ N-2 degrees of freedomS ~ 1
: fit consistent with errors,S > 1
: poor fit,S >> 1
: errors underestimated,S < 1
: overfitting or errors overestimated - Pearson's correlation coefficient $ρ$ that accounts for data errors
For more information and references see the LinearFitXYerrors.jl package at https://github.com/rafael-guerra-www/LinearFitXYerrors.jl
GMT.lines
— Functionlines(cmd0::String="", arg1=nothing; decorated=(...), kwargs...)
Reads a file or (x,y) pairs and plots a collection of different line with decorations
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
W | pen | line_attrib :: [Type => Str]
Set pen attributes for lines or the outline of symbols
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
Examples:
lines([0, 10]; [0, 20], limits=(-2,12,-2,22), proj="M2.5", pen=1, fill=:red,
decorated=(dist=(val=1,size=0.25), symbol=:box), show=true)
lines(x -> cos(x) * x, y -> sin(y) * y, linspace(0,2pi,100), region=(-4,7,-5.5,2.5), lw=2, lc=:sienna,
decorated=(quoted=true, const_label=" In Vino Veritas - In Aqua, Rãs & Toads", font=(25,"Times-Italic"),
curved=true, pen=(0.5,:red)), aspect=:equal, fmt=:png, show=true)
GMT.logo
— Functionlogo(cmd0::String=""; kwargs...)
Plots the GMT logo on a map. By default, the GMT logo is 5 cm wide and 2.5 cm high and will be positioned relative to the current plot origin. Use various options to change this and to place a transparent or opaque rectangular map panel behind the GMT logo.
See full GMT (not the GMT.jl
one) docs at gmtlogo
Parameters
D | pos | position :: [Type => Str]
Sets reference point on the map for the image using one of four coordinate systems.
F | box :: [Type => Str]
Without further options, draws a rectangular border around the GMT logo using
MAP_FRAME_PEN
. or map rose (T)julia :: [Type => Number]
Create the Julia instead of the GMT logo. Provide circle diameter in centimeters
GMTjulia :: [Type => Number]
Create the GMT Julia GMT logo. Provide circle diameter in centimeters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
Jz | zscale | zsize :: [Type => String]
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")Example, make a GMT Julia logo with circles of 1 cm: logo(GMTjulia=1, show=true)
GMT.lonlat2xy
— Functionlonlat2xy(lonlat::Matrix{<:Real}; t_srs, s_srs="+proj=longlat +datum=WGS84")
or
lonlat2xy(D::GMTdataset; t_srs, s_srs="+proj=longlat +datum=WGS84")
Computes the forward projection from LatLon to XY in the given projection. The input is assumed to be in WGS84. If it isn't, pass the appropriate projection info via the s_srs
option (PROJ4, WKT, EPSG).
Parameters
lonlat
: The input data. It can be a Matrix, or a GMTdataset (or vector of it)t_srs
: The destiny projection system. This can be a PROJ4, a WKT string or EPSG code
Returns
A Matrix if input is a Matrix or a GMTdadaset if input had that type
GMT.loxodrome
— Methodfunction loxodrome(lon1,lat1,lon2,lat2; step=0, unit=:m, np=0, proj::String="", epsg::Integer=0)
or
function loxodrome(D; step=0, unit=:m, np=0, proj::String="", epsg::Integer=0)
Generate a loxodrome (rhumb line) on an ellipsoid. Input data can be two or more points. In later case each line segment is descretized at step
increments,
Parameters
D
: - the input points. This can either be a 2x2 matrix or a GMTdataset. Note that only the first 2 points are used.step
: - Incremental distance at which the segment line is descretized in meters(the default), but seeunit
unit
: - Ifstep
is not in meters use one ofunit=:km
, orunit=:Nautical
orunit=:Miles
np
: - Number of intermediate points to be generated between end points (alternative tostep
)proj
- If line data is in Cartesians but with a known projection pass in a PROJ4 stringepsg
- Same asproj
but using an EPSG code
Returns
A Mx2 matrix with the on lat of the points along the loxodrome when input is a matrix or the 2 pairs of points. A GMTdataset when the input is GMTdataset.
Example: Compute an loxodrome between points (0,0) and (30,50) discretized at 100 km steps.
loxo = loxodrome([0 0; 30 50], step=100, unit=:k);
GMT.loxodrome_direct
— Functionloxodrome_direct(lon, lat, azimuth, distance, a=6378137.0, f=0.0033528106647474805)
Compute the direct problem of a loxodrome on the ellipsoid.
Given latitude and longitude of P1, azimuth a12 of the loxodrome P1P2 and the arc length s along the loxodrome curve, compute the latitude and longitude of P2.
Args:
lon, lat
: - longitude, latitude (degrees) of starting point.azimuth
: - azimuth (degrees)distance
: - distance to move from (lat,lon) in metersa
- major axis of the ellipsoid (meters). Default values for WGS84f
- flattening od the ellipsoid (default = 1 / 298.257223563)
Returns
- [lon lat] of destination after moving for [distance] metres in [azimuth] direction.
Example: Compute the end point at a bearing of 45 degrees 10000 meters from point 0,0
loxo = loxodrome_direct(0,0,45, 10000)
GMT.loxodrome_inverse
— Functionfunction loxodrome_inverse(lon1, lat1, lon2, lat2, a=6378137.0, f=0.0033528106647474805)
Compute the inverse problem of a loxodrome on the ellipsoid.
Given latitudes and longitudes of P1 and P2 on the ellipsoid, compute the azimuth a12 of the loxodrome P1P2, the arc length s along the loxodrome curve.
Args:
lon1, lat1, lon2, lat2
: - longitude and latitude of starting and end points (degrees).a
- major axis of the ellipsoid (meters). Default values for WGS84f
- flattening od the ellipsoid (default = 1 / 298.257223563)
Returns
- Distance (meters) and azimuth from P1 to P2
Example: Compute the distance and azimuth beyween points (0,0) and (5,5)
dist, azim = loxodrome_inverse(0,0,5,5)
GMT.lttb
— Functiony, ind = lttb(v::AbstractVector, decfactor=10)
D, ind = lttb(D::GMTdataset, decfactor=10)
The largest triangle, three-buckets reduction of the vector v
over points 1:N
to a new, shorter vector y
at x
with N = length(v) ÷ decfactor
.
Returns the shorter vector y
and indices of picked points in ind
See https://skemman.is/bitstream/1946/15343/3/SS_MSthesis.pdf
GMT.mad
— Methodmad(x)
Compute the median absolute deviation (MAD) of collection x
around the median
The MAD is multiplied by 1 / quantile(Normal(), 3/4) ≈ 1.4826
, in order to obtain a consistent estimator of the standard deviation under the assumption that the data is normally distributed.
GMT.magic
— MethodM = magic(n::Int) => Matrix{Int}
M = magic(n) returns an n-by-n matrix constructed from the integers 1 through n^2 with equal row and column sums. The order n must be a scalar greater than or equal to 3 in order to create a valid magic square.
GMT.makeDCWs
— FunctionmakeDCWs(fname; float=false, name_cdl="xxxx.cdl", name_nc="", compress=true,
attrib="", fix_RU::Bool=false, deltmp=true)
Convert the contents of the OGR file fname
into a NetCDF CDL or NC file with the structure of the GMT DCW format. So far, only administrative level 0 polygons (the country borders) are supported.
Parameters
fname
: The name of the file to be converted. It needs to be an OGR readable file with polygons and metadata containing codes in ISO 3166-1 Alpha-3 or Alpha-2. Note: if the file being converted is the "world-administrative-boundaries" from OpenDataSoft (see full link below), it lacks the Anctartica polygons. A trick to get it is to extract the Antractica polygons from a Natural Earth file. Specifically, if a file named "ne10madmin0countries.shp.zip" exists in the same directory as the one being converted, it will be used to extract the missing Antractica polygons.
Keywords
attrib
: The name of the attribute field in the OGR file that contains the country codes. It has to be an attribute whose value has to be either a ISO 3166-1 Alpha-3 or Alpha-2 code. For convenience, we provide defaults for 'Natural Earth' https://www.naturalearthdata.com/downloads/10m-cultural-vectors/ files (attrib="ADM0_A3"
), 'World Administrative Boundaries' https://public.opendatasoft.com/explore/dataset/world-administrative-boundaries/export/ (attrib="iso3"
) and 'Open Street Maps' (attrib="iso2"
). For other products, you will need to first load the file withgmtread
and then check the attributes to find out the attribute name that holds the country codes. Something like: $o = gmtread("the_file"); info(o[1].attrib)$float
: If true, save the coordinates in float 32 bits. The default is to use a scheme that scales the coordinates to fit in a UInt16 variable. GMT knows how to read both UInt16 and Float32 files.name_cdl
: The name of the CDL file (default: "xxxx.cdl"). This file gets deleted ifdeltmp
= true.name_nc
: Name of the final netCDF file. WARNING: for this operation to work it is MANDATORY that the executablencgen
is in the path.compress
: If true, compress the nc file with level 9 (default: true). Only used ifname_nc
is not empty and needs that the executablenccopy
is in the path.fix_RU
: The Russia polygon is often split at the dateline. If we find this is be true and this option istrue
, then it try to merge the two parts of Siberia in a single big Russia polygon. The default isfalse
because probability that this operation goes wrong is not that low. this attempt fails set it tofalse
and live with the split polygons.deltmp
: Delete temporary files (default: true). Only used ifname_nc
is not empty
Example
# Create a xxxx.cdl file with data scaled to Uint16 from the ne_10m_admin_0_countries_iso.shp.zip file
makeDCWs("ne_10m_admin_0_countries_iso.shp.zip")
# After that, to create a netCDF file "NE10m.nc" run in the command line:
ncgen -b -k 3 -o NE10m.nc -x xxxx.cdl
# and to compress it with level 9
nccopy -k 3 -d 9 -s NE10m.nc NE10m_9.nc
# To create a compressed netCDF file "NE10m.nc" with data stored in single precision.
makeDCWs("ne_10m_admin_0_countries_iso.shp.zip", name_nc="NE10m_f32.nc", float=true)
GMT.make_attrtbl
— Functionatt_tbl, att_names = make_attrtbl(D::GDtype, names::Bool=false; att::StrSymb="")
Create a string matrix with the dataset attributes. 'names', if true, returns also a string vector with attribute names. 'att', if == to one atribute, returns only that column of the att table.
GMT.makecpt
— Methodmakecpt(cmd0::String="", arg1=nothing; kwargs...)
or
makecpt(name::Symbol; kwargs...)
Make static color palette tables (CPTs). The second form accepts a name of one of the GMT CPT defaults.
See full GMT (not the GMT.jl
one) docs at makecpt
A | alpha | transparency :: [Type => Str]
Sets a constant level of transparency (0-100) for all color slices.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
D | bg | background :: [Type => Str | []]
Arg = [i|o]
Select the back- and foreground colors to match the colors for lowest and highest z-values in the output CPT.
E | nlevels :: [Type => Int | []]
Arg = [nlevels]
Implies reading data table(s) from file or arrays. We use the last data column to determine the data range
F | color_model :: [Type => Str | []]
Arg = [R|r|h|c][+c]]
Force output CPT to written with r/g/b codes, gray-scale values or color name.
G | truncate :: [Type => Str]
Arg = zlo/zhi
Truncate the incoming CPT so that the lowest and highest z-levels are to zlo and zhi.
I | inverse | reverse :: [Type => Str]
Arg = [c][z]
Reverse the sense of color progression in the master CPT.
M | overrule_bg :: [Type => Bool]
Overrule background, foreground, and NaN colors specified in the master CPT with the values of the parameters COLORBACKGROUND, COLORFOREGROUND, and COLOR_NAN.
N | no_bg | nobg :: [Type => Bool]
Do not write out the background, foreground, and NaN-color fields.
Q | log :: [Type => Bool | Str]
Arg = [i|o]
Selects a logarithmic interpolation scheme [Default is linear].
S | auto :: [Type => Bool | Str]
Arg = [mode]
Determine a suitable range for the -T option from the input table(s) (or stdin).
T | range :: [Type => Str]
Arg = [min/max/inc[+b|l|n]|file|list]
Defines the range of the new CPT by giving the lowest and highest z-value and interval.
W | wrap | categorical :: [Type => Bool | Str | []]
Arg = [w]
Do not interpolate the input color table but pick the output colors starting at the beginning of the color table, until colors for all intervals are assigned.
Z | continuous :: [Type => Bool]
Creates a continuous CPT [Default is discontinuous, i.e., constant colors for each interval].
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
To see the full documentation type: $@? makecpt$
GMT.mapproject
— Functionmapproject(cmd0::String="", arg1=nothing, kwargs...)
Forward and inverse map transformations, datum conversions and geodesy.
See full GMT (not the GMT.jl
one) docs at mapproject
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
A | azim | azimuth:: [Type => Str] $Arg = b|B|f|F|o|O[lon0/lat0][+v]$
Calculate azimuth along track or to the optional fixed point set with lon0/lat0.
C | center :: [Type => Str | List | []] $Arg = [dx/dy]$
Set center of projected coordinates to be at map projection center [Default is lower left corner].
D | lengthunit :: [Type => Str] $Arg = c|i|p$
Temporarily override PROJLENGTHUNIT and use c (cm), i (inch), or p (points) instead.
E | geod2ecef | ecef :: [Type => Str | []] $Arg = [datum]$
Convert from geodetic (lon, lat, height) to Earth Centered Earth Fixed (ECEF) (x,y,z) coordinates.
F | one2one :: [Type => Str | []] $Arg = [unit]$
Force 1:1 scaling, i.e., output (or input, see I) data are in actual projected meters.
G | track_distances :: [Type => Str | List] $Arg = [lon0/lat0][+a][+i][+u[+|-]unit][+v]$
Calculate distances along track or to the optional fixed point set with G="lon0/lat0".
I | inverse :: [Type => Bool]
Do the Inverse transformation, i.e., get (longitude,latitude) from (x,y) data.
L | dist2line :: [Type => Str | NamedTuple] $Arg = line.xy[+u[+|-]unit][+p] | (line=Matrix, unit=x, fractional_pt=_,cartesian=true, projected=true)$
Determine the shortest distance from the input data points to the line(s) given in the ASCII multisegment file line.xy.
N | geod2aux :: [Type => Str | []] $Arg = [a|c|g|m]$
Convert from geodetic latitudes to one of four different auxiliary latitudes (longitudes are unaffected).
Q | list :: [Type => Str | []] $Arg = [d|e]$
List all projection parameters. To only list datums, use Q=:d, to only list ellipsoids, use Q=:e.
S | supress :: [Type => Bool]
Suppress points that fall outside the region.
T | change_datum :: [Type => Str] $Arg = [h]from[/to]$
Coordinate conversions between datums from and to using the standard Molodensky transformation.
W | map_size | mapsize :: [Type => Str | []] $Arg = [w|h]$
Prints map width and height on standard output. No input files are read.
Z | traveltime | travel_times :: [Type => Str | Number] $Arg = [speed][+a][+i][+f][+tepoch]$
Calculate travel times along track as specified with -G.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
s | skiprows | skip_NaN :: [Type => Str] $Arg = [cols][a|r]$
Suppress output for records whose z-value equals NaN.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? mapproject$
GMT.marginalhist
— Methodmarginalhist(data; kwargs...)
Takes a Mx2 array, and make a scatter plot of first vs second column. The default is to do a scatter3 plot if number of points <= 200 and bihex plot otherwise, but this is configurable. Input data
can be a MxN matrix, a GMTdataset
or a file name that upon reading with gmtread
returns a GMTdataset
.
marginalhist(data)
: Plots a x,y scatterplot with marginal histograms for x and y.marginalhist(..., frac|fraction=xx)
: Set fractional size of the marginal plots with respect to the figure size. Default is 0.15 (15%).marginalhist(..., hexbin=true)
: Force hexbin plots even when number of points <= 2000.marginalhist(..., scatter=true)
: Force scatter plots even when number of points > 2000.marginalhist(..., density=true)
: Side plots contain data kernel density instead of histograms.marginalhist(..., gap=xx)
: Set the gap in centimeters between the fig and the marginal plots.marginalhist(..., histcolor|histfill=color)
: To paint the side histograms/density with a selected color (histcolor=:none to no paint).marginalhist(..., nocbar=true)
: To not plot the color bar when doing a hexbin plot.marginalhist(..., histkw=args)
: Whereargs
is a NamedTuple with parameters controlling the histogram plot (same options as those that would be passed to thehistogram
module, exceptregion
andfigsize
).
Several more options in kwargs
can be used to control plot details (and are passed to the subplot
, binstats
and plot
functions.)
Example: marginalhist(randn(2500,2), scatter=true, histkw=(annot=true,), show=true)
marginalhist(randn(2000,2), histkw=(frame="none", fill=:green, W="0@100"), show=true)
marginalhist(randn(2500,2), cmap=:magma, density=true, show=1)
GMT.mask
— Functionmask(cmd0::String="", arg1=nothing; kwargs...)
Clip or mask map areas with no data table coverage
See full GMT (not the GMT.jl
one) docs at psmask
Parameters
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | endclip | endclippath :: [Type => Bool]
Mark end of existing clip path. No input file is needed.
D | dump :: [Type => Str]
Dump the (x,y) coordinates of each clipping polygon to one or more output files (or stdout if template is not given).
F | oriented :: [Type => Str | []]
Force clip contours (polygons) to be oriented so that data points are to the left (-Fl [Default]) or right (-Fr)
G | fill :: [Type => Number | Str]
Set fill shade, color or pattern for positive and/or negative masks [Default is no fill].
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
Jz | zscale | zsize :: [Type => String]
L | nodegrid :: [Type => Str]
Save the internal grid with ones (data constraint) and zeros (no data) to the named nodegrid.
N | invert | inverse :: [Type => Bool]
Invert the sense of the test, i.e., clip regions where there is data coverage.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | cut | cut_number :: [Type => Number | Str]
Do not dump polygons with less than cut number of points [Dumps all polygons].
S | search_radius :: [Type => Number | Str]
Sets radius of influence. Grid nodes within radius of a data point are considered reliable.
T | tiles :: [Type => Bool]
Plot tiles instead of clip polygons. Use -G to set tile color or pattern. Cannot be used with -D.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? mask$
GMT.maskgdal
— Methodmaskgdal(D::GDtype, nx, ny; region=Float64[], touches=false, layout::String="", inverse=false)
GMT.mat2ds
— MethodD = mat2ds(D::GMTdataset, inds::Tuple) -> GMTdataset
Cut a GMTdataset D with the indices in INDS but updating the colnames and the Timecol info. INDS is a Tuple of 2 with ranges in rows and columns. Ex: (:, 1:3) or (:, [1,4,7]), etc... Attention, if original had attributes other than 'Timeinfo' there is no guarentie that they remain correct.
GMT.mat2ds
— MethodD = mat2ds(mat [,txt]; x=nothing, text=nothing, multi=false, geom=0, kwargs...)
Take a 2D mat
array and convert it into a GMTdataset. x
is an optional coordinates vector (must have the same number of elements as rows in mat
). Use x=:ny
to generate a coords array 1:nrows of mat
. Alternatively, if mat
is a string or vector of strings we return a dataset with NaN's in the place of the coordinates. This form is useful to pass to text
when using the `regionjustify` option that does not need explicit coordinates to place the text.
txt
: Return a Text record which is a Dataset with data = Mx2 and text in third column. The $text$ can be an array with same size asmat
rows or a string (will be repeated n_rows times.)x
: An optional vector with the xx coordinateshdr
: optional String vector with either one or n_rows multis-egment headers.lc
orlinecolor
orcolor
: optional array of strings/symbols with color names/values. Its length can be smaller than n_cols, case in which colors will be cycled. Ifcolor
is not an array of strings, e.g.color="yes"
, the colors cycle trough a pre-defined set of colors (same colors as in Matlab). If you want the same color repeated for many lines pass color as a vector. e.g,color=[color]
linethick
orlt
: for selecting different line thicknesses. Works likecolor
, but should be a vector of numbers, or just a single number that is then applied to all lines.fill
: Optional string array (or a String of comma separated color names, or a Tuple of color names) with color names or array of "patterns".fillalpha
: Whenfill
option is used, we can set the transparency of filled polygons with this option that takes in an array (vec or 1-row matrix) with numeric values between [0-1] or ]1-100], where 100 (or 1) means full transparency.is3D
: If input 'mat' contains at least x,y,z (?).ls
orlinestyle
: Line style. A string or an array of strings withlength = size(mat,2)
with line styles.front
: Front Line style. A string or an array of strings withlength = size(mat,2)
with front line styles.pen
: A full pen setting. A string or an array of strings withlength = size(mat,2)
with pen settings. This differs fromlt
in the sense thatlt
does not directly set the line thickness.multi
ormulticol
: When number of columns inmat
> 2, or == 2 and x != nothing, make an multisegment Dataset with first column and 2, first and 3, etc. Convenient when want to plot a matrix where each column is a line.segnan
ornanseg
: Boolean. If true make a multi-segment made out of segments separated by NaNs.datatype
: Keep the original data type ofmat
. Default converts to Float64.geom
: The data geometry. By default, we setwkbUnknown
but try to do some basic guess.proj
orproj4
: A proj4 string for dataset SRS.wkt
: A WKT SRS.colnames
: Optional string vector with names for each column ofmat
.attrib
: Optional dictionary{String, String} with attributes of this dataset.ref:
Pass in a reference GMTdataset from which we'll take the georeference info as well asattrib
andcolnames
txtcol
ortextcol
: Vector{String} with text to add into the .text field. Warning: no testing is done to check if $length(txtcol) == size(mat,1)$ as it must.
GMT.mat2ds
— MethodD = mat2ds(mat::Vector{<:AbstractMatrix}; hdr=String[], kwargs...)::Vector{GMTdataset}
Create a multi-segment GMTdataset (a vector of GMTdataset) from matrices passed in a vector-of-matrices mat
. The matrices elements of mat
do not need to have the same number of rows. Think on this as specifying groups of lines/points each sharing the same settings. KWarg options of this form are more limited in number than in the general case, but can take the form of a Vector{Vector}, Vector or scalars. In the former case (Vector{Vector}) the length of each Vector[i] must equal to the number of rows of each mat[i].
hdr
: optional String vector with either one orlength(mat)
multi-segment headers.pen
: A full pen setting. A string or an array of strings withlength = length(mat)
with pen settings.lc
orlinecolor
orcolor
: optional color or array of strings/symbols with color names/values.linethick
orlt
: for selecting different line thicknesses. Works likecolor
, but should be a vector of numbers, or just a single number that is then applied to all lines.ls
orlinestyle
: Line style. A string or an array of strings withlength = length(mat)
with line styles.front
: Front Line style. A string or an array of strings withlength = length(mat)
with front line styles.fill
: Optional string array (or a String of comma separated color names, or a Tuple of color names) with color names or array of "patterns".fillalpha
: Whenfill
option is used, we can set the transparency of filled polygons or symbols with this option that takes in an array (vec or 1-row matrix) with numeric values between [0-1] or ]1-100], where 100 (or 1) means full transparency.
Example:
D = mat2ds([rand(6,3), rand(4,3), rand(3,3)], fill=[[:red], [:green], [:blue]], fillalpha=[0.5,0.7,0.8])
GMT.mat2ds
— MethodD = mat2ds(mat::Array{T,N}, D::GMTdataset)
Take a 2D mat
array and convert it into a GMTdataset. Pass in a reference GMTdataset from which we'll take the georeference info as well as attrib
and colnames
.
GMT.mat2dsnan
— Methodmat2dsnan(mat::Matrix{<:Real}; is3D=false, kw...)
Break the matrix mat
in a series of GMTdatasets using NaN as the breaking flag. By default it only checks for NaNs in the first two columns. Use is3D=true
to also check the third column. The kw
argument is the same as used in mat2ds()
.
Example, create a vector of 2 GMTdatasets:
mat2dsnan([0 1; 1 1; NaN 0; 2 2 3 3])
GMT.mat2grid
— FunctionG = mat2grid(mat; reg=nothing, x=[], y=[], v=[], hdr=[], proj4::String="", wkt::String="",
title::String="", rem::String="", cmd::String="", names::Vector{String}=String[],
scale::Float32=1f0, offset::Float32=0f0, eqc=false)
Take a 2/3D mat
array and a HDR 1x9 [xmin xmax ymin ymax zmin zmax reg xinc yinc] header descriptor and return a grid GMTgrid type. Alternatively to HDR, provide a pair of vectors, x
& y
, with the X and Y coordinates. Optionally add a v
vector with vertical coordinates if mat
is a 3D array and one wants to create a $cube$. Optionally, the HDR arg may be omitted and it will computed from mat
alone, but then x=1:ncol, y=1:nrow When HDR is not used, REG == nothing [default] means create a gridline registration grid and REG = 1, or REG="pixel" a pixel registered grid.
eqc
: If true, it means we got a matrix representing a Equidistant Cylindrical projection but with no coords. The output grid will have global coordinates between [-180 180] and [-90 90]. The xinc and yinc will be computed from themat
size and and a guess of the registration type based on the if dims are even (pixel) or odd (grid). Override the registration guessing with thereg
option. For non Earth bodies user must specify aproj4
option.
For 3D arrays the names
option is used to give a description for each layer (also saved to file when using a GDAL function).
The scale
and offset
options are used when mat
is an Integer type and we want to save the grid with a scale/offset.
Other methods of this function do:
G = mat2grid(val=0.0f; hdr=hdr_vec, reg=0, proj4::String="", wkt::String="", title::String="", rem::String="")
Create Float GMTgrid with size, coordinates and increment determined by the contents of the HDR var. This array, which is now MANDATORY, has either the same meaning as above OR, alternatively, containing only [xmin xmax ymin ymax xinc yinc] VAL is the value that will be fill the matrix (default VAL = Float32(0)). To get a Float64 array use, for example, VAL = 1.0 Any other non Float64 will be converted to Float32
Example: mat2grid(1, hdr=[0. 5 0 5 1 1])
G = mat2grid(f::Function, x, y; reg=nothing, proj4::String="", wkt::String="", epsg::Int=0, title::String="", rem::String="")
Where F is a function and X,Y the vectors coordinates defining it's domain. Creates a Float32 GMTgrid with size determined by the sizes of the X & Y vectors.
Example: f(x,y) = x^2 + y^2; G = mat2grid(f, x = -2:0.05:2, y = -2:0.05:2)
G = mat2grid(f::String)
Where f is a pre-set function name. Currently available:
- "ackley", "eggbox", "sombrero", "parabola" and "rosenbrock"
X,Y are vectors coordinates defining the function's domain, but default values are provided for each function. creates a Float32 GMTgrid.
Example: G = mat2grid("sombrero")
GMT.mat2img
— MethodI = mat2img(mat::Array{<:Unsigned}; x=[], y=[], hdr=[], proj4="", wkt="", cmap=GMTcpt(), kw...)
Take a 2D 'mat' array and a hdr
1x9 [xmin xmax ymin ymax zmin zmax reg xinc yinc] header descriptor and return a GMTimage type. Alternatively to hdr
, provide a pair of vectors, x & y, with the X and Y coordinates. Optionally, the hdr
arg may be omitted and it will computed from mat
alone, but then x=1:ncol, y=1:nrow When mat
is a 3D UInt16 array we automatically compute a UInt8 RGB image. In that case cmap
is ignored. But if no conversion is wanted use option noconv=true
I = mat2img(mat::Array{UInt16}; x=[], y=[], hdr=[], proj4::String="", wkt::String="", kw...)
Take a mat
array of UInt16 and scale it down to UInt8. Input can be 2D or 3D. If the kw variable stretch
is used, we stretch the intervals in stretch
to [0 255]. Use this option to stretch the image histogram. If stretch
is a scalar, scale the values > stretch
to [0 255]
- stretch = [v1 v2] scales all values >= v1 && <= v2 to [0 255]
- stretch = [v1 v2 v3 v4 v5 v6] scales first band >= v1 && <= v2 to [0 255], second >= v3 && <= v4, same for third
- stretch = :auto | "auto" | true | 1 will do an automatic stretching from values obtained from histogram thresholds
The kw...
kwargs search for [:layout :mem_layout], [:names] and [:metadata]
GMT.matchbox
— MethodGMT.mbgetdata
— Functionmbgetdata(cmd0::String=""; kwargs...)
Extract bathymetry, sidescan or amplitude data from datafiles.
Parameters
A | flagged :: [Type => Number] $Arg = value$
Replace flagged beans with NaN. Use -A<val> to assign a constant value to the flagged beans.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
C | datatype | data_type :: [Type => Number | Str | Tuple] $Arg = 0 or "a"$
Output SideScan, or amplitude, instead of bathymetry. This case ignores A
D | scaling :: [Type => Str | Tuple] $Arg = <mode>/<ampscale>/<ampmin>/<ampmax>$
Sets scaling of beam amplitude or sidescan pixel values which can be applied before plotting.
F | format :: [Type => Int]
Sets the format for the input swath sonar data using MBIO integer format identifiers.
S | speed :: [Type => Number]
Sets the parameters controlng simulated illumination of bathymetry.
T | timegap :: [Type => number]
Sets the maximum time gap in minutes between adjacent pings before being considered a gap.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
GMT.mbimport
— Functionmbimport(cmd0::String="", arg1=nothing, arg2=nothing, arg3=nothing; kwargs...)
Produces a gray-shaded (or colored) map by plotting rectangles centered on each grid node and assigning them a gray-shade (or color) based on the z-value.
Parameters
A | footprint :: [Type => Str | Tuple] $Arg = factor/mode/depth$
Determines how the along-track dimension of the beam or pixel footprints is calculated.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
D | scaling :: [Type => Str | Tuple] $Arg = mode/scale/min/max$
Sets scaling of beam amplitude or sidescan pixel values which can be applied before plotting.
E | dpi :: [Type => Int]
Sets the resolution of the projected image that will be created.
G | bit_color :: [Type => Str | Tuple] $Arg = magnitude/azimuth or magnitude/median$
Sets the parameters controlng simulated illumination of bathymetry.
S | speed :: [Type => Number]
Sets the minimum speed in km/hr (5.5 kts ~ 10 km/hr) allowed in the input data.
T | timegap :: [Type => number]
Sets the maximum time gap in minutes between adjacent pings before being considered a gap.
Z | type_plot :: [Type => Str | Number]
Sets the style of the plot.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
GMT.mblevitus
— Functionmblevitus(cmd0::String=""; kwargs...)
Create a water velocity profile which is representative of the mean annual water column for a specified 1 degree by 1 degree region.
Parameters
A | all4 :: [Type => Bool]
Pint also depth, velocity, temperature, salinity.
L | location :: [Type => Str | Tuple] $Arg = lon/lat$
Sets the longitude and latitude of the location of the water velocity profile.
O | outfile | out_file :: [Type => Str]
Write the SVP to <outfile>.
H | help :: [Type => Bool]
Print out program's description.
z | z_down :: [Type => Bool]
Makes Z axes positive down (default here is Z-up).
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
GMT.mbsvplist
— Functionmbsvplist(cmd0::String=""; kwargs...)
List water sound velocity profiles in swath sonar data files.
Parameters
C | uniquesvp :: [Type => Bool]
Output the number of unique SVPs in each file.
F | format :: [Type => Int]
Sets the format for the input swath sonar data.
M | mode :: [Type => Int] $Arg = 1 or 2 or 3$
Sets the SVP output mode..
S | ssv :: [Type => Bool]
Sets the minimum speed in km/hr (5.5 kts ~ 10 km/hr) allowed in the input data.
Z | firstiszero :: [Type => Bool]
Sets the style of the plot.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
GMT.meca
— Methodmeca(cmd0::String="", arg1=nothing; kwargs...)
Plot focal mechanisms.
See full GMT (not the GMT.jl
one) docs at meca
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
A | offset :: [Type => Bool | Str | GMTcpt]
Offsets focal mechanisms to the longitude, latitude specified in the last two columns of the input
C | color | cmap :: [Type => Number | Str | GMTcpt]
Give a CPT and let compressive part color be determined by the z-value in the third column.
D | depth_limits :: [Type => Str | Tuple]
Plots events between depmin and depmax.
E | fill_extensive | extensionfill :: [Type => Str | Number]
Selects filling of extensive quadrants. [Default is white].
Fa | Fe | Fg | Fo | Fp | Fr | Ft | Fz :: [Type => ]
Sets one or more attributes.
G | fill | compressionfill :: [Type => Str | Number]
Selects shade, color or pattern for filling the sectors [Default is no fill].
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
L | outline_pen | pen_outline :: [Type => Str | Number | Tuple]
Draws the “beach ball” outline with pen attributes instead of with the default pen set by pen
M | same_size | samesize :: [Type => Bool]
Use the same size for any magnitude. Size is given with S
N | no_clip | noclip :: [Type => Str | []]
Do NOT skip symbols that fall outside frame boundary.
Sc|aki | Sc|CMT|gcmt | Sm|mt|moment_tensor | ... :: [Type => Str]
Selects the meaning of the columns in the input data.
**convention=:Sa|:aki|:Sc|:CMT|:gcmt|:Sm|:mt|:momenttensor|:Sd|:mtclosest|:momentclosest|:Sz|:mtdeviatoric :momentdeviatoric|:Sp :partial|:Sx|:principal|:principalaxis|:Sy|:principalclosest|:St|:principaldeviatoric
Alternative way of selecting the meaning of the columns in the input data.
T | nodal :: [Type => Number | Str]
Plots the nodal planes and outlines the bubble which is transparent.
W | pen :: [Type => Str | Tuple]
Set pen attributes for all lines and the outline of symbols.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
Example: Plot a focal mechanism using the Aki & Richards convention
psmeca([0.0 3.0 0.0 0 45 90 5 0 0], aki=true, fill=:black, region=(-1,4,0,6), proj=:Merc, show=1)
The same but add a Label
psmeca(mat2ds([0.0 3.0 0.0 0 45 90 5 0 0], ["Thrust"]), aki=true, fill=:black, region=(-1,4,0,6), proj=:Merc, show=1)
GMT.mk_codes_values
— Methodcode, vals = mk_codes_values(codes::Vector{String}, vals; region::StrSymb="world")
Take a list of country codes
in the ISO alpha-3 country code names, a vector of numeric
valsthat will be used in a choropleth and select only those that belong to the region
region`. Possible values for region are: "world", "eu", "af" or "na".
Returns code
in the ISO alpha-2 country code names and corresponding vals
. This output is then usable in cpt2dcw() to create a colormap to use in plot()
and make a country choropleth map.
GMT.mksymbol
— Functionmksymbol(f::Function, cmd0::String="", arg1=nothing; kwargs...)
GMT.mosaic
— MethodI = mosaic(lon, lat; pt_radius=6378137.0, provider="", zoom::Int=0, cache::String="",
mapwidth=15, dpi=96, verbose::Int=0, kw...)
Get image tiles from a web map tiles provider for given longitude, latitude coordinates.
Arguments
lon
&lat
:lon, lat
: two scalars with the coordinates of region of interest center. To completly define the image area see theneighbors
ormosaic
option below.lon, lat
are two elements vector or matrix with the region's [lon_min, lon_max], [lat_min, lat_max].- Instead of two arguments, pass just one containing a GMTdataset obtained with the $geocoder$ function. Example: $mosaic(D, ...)$ or, if the search with $geocoder$ was sufficiently generic (see its docs), $mosaic(D, bbox=true)$ to use the BoundingBox returned by the query.
bbox
supportsbb
,BB
orBoundingBox
as aliases. - Yet another alternative is to pass either a GMTgrid or a GMTimage with a valid projection, and it doesn't need to be in geographic coordinates. Coordinates in other reference systems will be converted to geogs.
- Finaly, all of the above options can be skipped if the keyword
region
is used. Note that this option is the same as in, for example, the $coast$ module. And that means we can use it with $earthregions$ arguments. e.g. $region="IT"$ is a valid option and will get the tiles needed to build an image of Italy.
pt_radius
: The planetary radius. Defaults to Earth's WGS84 equatorial radius (6378137 m).provider
: Tile provider name. Currently available options are (but for more details see the docs of thegetprovider
function, i.e. $? getprovider$):- "Bing" (the default), "Google", "OSM", "Esri" or a custom provider.
- A
Provider
type from the $TileProviders.jl$ package. You must consult the documentation of that package for more details on how to choose a provider.
zoom
: Zoom level (0 for automatic). A number between 0 and ~19. The maximum is provider and area dependent. Ifzoom=0
, the zoom level is computed automatically based on themapwidth
anddpi
options.cache
: Full name of the the cache directory where to save the downloaded tiles. If empty, a cache directory is created in the system's TMP directory. Ifcache="gmt"
the cache directory is created in $~/.gmt/cache_tileserver$. NOTE: this normally is neeaded only for the first time you run this function when, ifcache!=""
, the cache dir location is saved in the $~./gmt/tiles_cache_dir.txt$ file and used in subsequent calls.mapwidth
: Map width in cm. Used together with thedpi
option to automatically compute the zoom level.dpi
: Dots per inch. Used together with themapwidth
option to automatically compute the zoom level.verbose
: Verbosity level. A number between 0 and 2. Print out info while downloading the image files. Silent when geting files from local cache unlessverbose=2
, where it prints out info about the files found in the cache.
kwargs (kw...)
neighbors
ormosaic
: Whenlon
andlat
are scalars, this option specifies the number of neighbors of the tile containing the query point to download. Normally this should be an odd number, but it can take the form of a matrix and the number of tiles is then determined by the number of rows and columns.merc
ormercator
: Return tiled image in Mercator coordinates. The default is to project it back to geographical coordinates.loose
orloose_bounds
: By default we return an image with the limits requested in thelon
andlat
arguments. This option makes it return an image with the limits that are determined by those of the tiles that intersect the requested region. Note that this does not work for point queries.quadonly
: Return only the quadtree string. A string or a matrix of strings when number of tiles > 1. Other from the quadtree string this option return also thedecimal_adress, lon, lat, x, y
that are: the XYZ tiles coordinates, the longitude, latitude , mercator X and Y coordinates in meters of first tile.tilesmesh
ormeshtiles
ormesh
: Return aGMTdataset
with the mesh of tiles.
Returns
I
: A GMTimage element or the output of thequadonly
option explained above.
Examples
julia> I = mosaic(0.1,0.1,zoom=1)
viz(I, coast=true)
# Return a GMTdataset with the mesh of tiles and viz it.
D = mosaic(region=(-10, -8, 37, 39), zoom=9, mesh=true);
viz(D, coast=true)
GMT.mosaic
— MethodI = mosaic(GI::Union{GMTgrid, GMTimage}; ...)
Same as above but the lon
& lat
are extracted from the GI
header. The grid or image GI
must have set a valid projection, and it doesn't need to be in geographic coordinates. Coordinates in other reference systems will be converted to geogs.
GMT.mosaic
— MethodI = mosaic(address::String; ...)
Same as above but the lon
& lat
are extracted from the address
code. The code can be a $quadtree$ or a $XYZ$ tile address. This is a more specialized usage that relies on users knowledge on tile code names based on quadtrees or XYZ encoding. An example of these codes is provided by the attributes of when we use the mesh=true
option.
An important difference between the address
option and the lon & lat
option is that the address
option also set the zoom level, so here the $zoom$ option means the extra zoom level added to that implied by $address$. A number highr than 3 is suspiciously large.
Example
julia> I = mosaic("033110322", zoom=2)
viz(I, coast=true)
GMT.mosaic
— MethodI = mosaic(address::VecOrMat{<:Real}; ...)
Very similar to above but where address
is a $XYZ$ tile address given as a vector of 3 integers.
GMT.mosaic
— MethodI = mosaic(; region=??, ...)
Same as above but this time the BoundingBox is extracted from the region
option. Note that this option is the same as in, for example, the coast
module.
Example
julia> I = mosaic(region=(91,110,6,22)) # zoom level is computed automatically
viz(I, coast=true)
GMT.movie
— Methodmovie(main; pre=nothing, post=nothing, kwargs...)
Create animation sequences and movies.
See full GMT (not the GMT.jl
one) docs at movie
Parameters
main :: [Type => Str]
Name of a stand-alone GMT.jl script that makes the frame-dependent plot.``
C | canvas :: [Type => Str]
Specify the canvas size used when composing the movie frames. (http://docs.generic-mapping-tools.org/latest/movie.html#c)
N | name :: [Type => Str]
Determines the name of a sub-directory with frame images as well as the final movie file. (http://docs.generic-mapping-tools.org/latest/movie.html#n)
T | frames :: [Type => Int | Str]
Either specify how many image frames to make or supply a file with a set of parameters, one record per frame (i.e., row). (http://docs.generic-mapping-tools.org/latest/movie.html#t)
pre :: [Type => Str]
The optional backgroundscript file (a GMT.jl script) can be used one or two purposes: (1) It may create files (such as timefile) that will be needed by mainscript to make the movie, and (2) It may make a static background plot that should form the background for all frames. (http://docs.generic-mapping-tools.org/latest/movie.html#s)
post :: [Type => Str]
The optional foregroundscript file (a GMT.jl script) can be used to make a static foreground plot that should be overlain on all frames. (http://docs.generic-mapping-tools.org/latest/movie.html#s)
A | gif :: [Type => Str] $Args = [+l[n]][+sstride]$
Build an animated GIF file. You may specify if the movie should play more than once and if so append how many times to repeat. (http://docs.generic-mapping-tools.org/latest/movie.html#a)
D | frame_rate :: [Type => Int]
Set the display frame rate in frames per seconds for the final animation [24]. (http://docs.generic-mapping-tools.org/latest/movie.html#d)
E | titlepage :: [Type => Str | tuple]
Give a titlepage script that creates a static title page for the movie [no title]. (http://docs.generic-mapping-tools.org/latest/movie.html#e)
F | format :: [Type => Str] $Arg = format[+ooptions]$
Set the format of the final video product. Choose either mp4 (MPEG-4 movie) or webm (WebM movie). (http://docs.generic-mapping-tools.org/latest/movie.html#f)
G | fill :: [Type => Str | Int | Touple]
Set the canvas color or fill before plotting commences [none]. (http://docs.generic-mapping-tools.org/latest/movie.html#g)
H | scale :: [Type => Number]
Temporarily increases the effective dots-per-unit by factor, rasterizes the frame, then downsamples the image by the same factor at the end. (http://docs.generic-mapping-tools.org/latest/movie.html#h)
I | includefile :: [Type => Str]
Insert the contents of includefile into the movie_init script that is accessed by all movie scripts. (http://docs.generic-mapping-tools.org/latest/movie.html#i)
K | fading :: [Type => Number | Str | Tuple] $Arg = [+f[i|o]fade[s]][+gfill][+p] ]$
Add fading in and out for the main animation sequence [no fading]. (http://docs.generic-mapping-tools.org/latest/movie.html#k)
L | label :: [Type => Str]
Automatic labeling of individual frames. (http://docs.generic-mapping-tools.org/latest/movie.html#l)
M | cover_page :: [Type => number] $Arg = frame[,format]$
Select a single frame for a cover page. This frame will be written to the current directory. (http://docs.generic-mapping-tools.org/latest/movie.html#m)
P | progress :: [Type => Str | Tuple]
Automatic placement of progress indicator(s). (http://docs.generic-mapping-tools.org/latest/movie.html#p)
Q | debug :: [Type => Bool | Str] $Arg = [s]$
Debugging: Leave all files and directories we create behind for inspection. (http://docs.generic-mapping-tools.org/latest/movie.html#q)
Sb | background :: [Type => Str | Function]
Optional background script or bg PS file GMT6.1 only
Sf | foreground :: [Type => Str | Function]
Optional foreground script or fg PS file GMT6.1 only
W | work_dir :: [Type => Str]
By default, all temporary files and frame PNG file are built in the subdirectory prefix set via name. You can override that by giving another workdir as a relative or full directory path. (http://docs.generic-mapping-tools.org/latest/movie.html#w)
Z | clean :: [Type => Bool]
Erase the entire name directory after assembling the final movie [Default leaves directory with all images. (http://docs.generic-mapping-tools.org/latest/movie.html#z)
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
x | cores | n_threads :: [Type => Str or Number] $Arg = [[-]n]$
Limit the number of cores to be used in any OpenMP-enabled multi-threaded algorithms. (http://docs.generic-mapping-tools.org/latest/gmt.html#x-full)
GMT.nearneighbor
— Methodnearneighbor(cmd0::String="", arg1=nothing; kwargs...)
Reads arbitrarily located (x,y,z[,w]) triples [quadruplets] and uses a nearest neighbor algorithm to assign an average value to each node that have one or more points within a radius centered on the node. The average value is computed as a weighted mean of the nearest point from each sector inside the search radius. The weighting function used is w(r) = 1 / (1 + d ^ 2), where d = 3 * r / search_radius and r is distance from the node. This weight is modulated by the weights of the observation points [if supplied].
See full GMT (not the GMT.jl
one) docs at nearneighbor
Parameters
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
N | sectors | nn | nearest :: [Type => Number | Str | Bool (for nn or nearest)]
The circular area centered on each node is divided into
sectors
sectors.R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | search_radius :: [Type => Number]
Sets the search_radius that determines which data points are considered close to a node.
E | empty :: [Type => Bool]
Set the value assigned to empty nodes when G is set [NaN].
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = nearneighbor(....) form.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | weights :: [Type => Bool]
Input data have a 4th column containing observation point weights.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
n | interp | interpolation :: [Type => Str] $Arg = [b|c|l|n][+a][+bBC][+c][+tthreshold]$
Select grid interpolation mode by adding b for B-spline smoothing, c for bicubic interpolation, l for bilinear interpolation, or n for nearest-neighbor value.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? nearneighbor$
GMT.octahedron
— FunctionFV = octahedron(r=1.0)
Creates an octahedron mesh with radius r
.
GMT.orbits
— Functionorbits(xyz::Matrix{<:Real}; first=true, radius=6371.007, height=0, lon0=0, lat0=0, show=false, kw...)
Plots the orbit, or whatever the input data in xyz
represents, about the Earth or other planetary bodies.
xyz
: The orbit coordinates. By default, we expect the coordinates in the Earth Centered Earth Fixed (ECEF) system but they can be in spherical coordinates (lon, lat) as well. In this casexyz
must be a Mx2 matrix andheight
(the orbit height) must be > 0. If this argument is omitted, we plot a demo spiral "orbit".radius
: The planetary body (spherical) radius. This value may be passed in meters or km and is only used when input is passed in spherical coordinates.first
: Boolean that indicates if $orbits$ creates the first layer of the image plot. If the default value oftrue
is used, we also make a call to $coast$ to plot the Earth using an Orthographic projection. The default option for this is plot the coastlines only, bur other options, e.g. colorizing the continents, are also available via thekw...
arguments. Settingfirst=false
, or better, use the $orbits!$ form, skips the $coast$ call, which lets this plot be appended to a previous plot as for example the one produced by $grdimage$ on a Eart's DEM. Note, however, that in this case the previous plot must have used the samelon0
andlat0
otherwise the visible orbit will be wrong.lon0
: Central longitude of the Orthographic projection.lat0
: Central latitude of the Orthographic projection.height
: Used when inputxyz
is a Mx2 (lon, lat) matrix and represents the height in meters above the sphere of radiusradius
. (MUST be > 0 and not 'too small' or this function's algorithm fails.)show
: Set this totrue
if want to see the produced image. Leaving it asfalse
permits adding more elements by posterior plotting calls.kw
: keyword arguments to be consumed in the $coast$ and $plot3$ calls. For example,land=:tomato, lw=1, lc=:blue
paints the continent with thetomato
color and plots the orbits with blue, 1pt thick lines.
Example:
orbits(show=true)
GMT.parallelplot
— Methodparallelplot(cmd0="", arg1=nothing; labels|axeslabels=String[], group=Vector{String},
groupvar="", normalize="range", kwargs...)
axeslabels
orlabels
: String vector with the names of each variable axis. Plots a default "Label?" if not provided.group
: A string vector or vector of integers used to group the lines in the plot.groupvar
: Uses the table variable specified bygroupvar
to group the lines in the plot.groupvar
can be a column number, or a column name passed in as a Symbol. e.g.groupvar=:Male
if a column with that name exists. Whenarg1
is GMTdatset orcmd0
is the name of a file with one and it has thetext
field filled, usegroupvar="text"
to use that text field as the grouping vector.yvar
: This can take the form of column names or column numbers. Exampleyvar=(2,3)
, oryvar=[:Y, :Z1, :Z2]
.nomalize
:range
: (Default) Display raw data along coordinate rulers that have independent minimum and maximum limits.
- `none`: Display raw data along coordinate rulers that have the same minimum and maximum limits.
- `zscore`: Display z-scores (with a mean of 0 and a standard deviation of 1) along each coordinate ruler.
- `scale`: Display values scaled by standard deviation along each coordinate ruler.
quantile
: Give a quantile in the [0-1] interval to plot the median +-quantile
as dashed lines.std
: Instead of median plus quantile lines, draw the mean +- one standard deviation. This is achieved with bothstd=true
orstd=1
. For other number od standard deviations use, e.g.std=2
, orstd=1.5
.band
: If used, instead of the dashed lines referred above, plot a band centered in the median. The band colors are assigned automatically but this can be overriden by thefill
option. If set andquantile
not given, set a default ofquantile = 0.25
.fill
: Whenband
option is used and want to control the bands colors, give a list of colors to paint them.fillalpha
: Whenfill
option is used, we can set the bands transparency with this option that takes in an array (vec or 1-row matrix) with numeric values between [0-1] or ]1-100], where 100 (or 1) means full transparency.- For fine the lines settings use the same options as in the
plot
module.
Example:
parallelplot("iris.dat", groupvar="text", quantile=0.25, legend=true, band=true, show=1)
GMT.pca
— Methodscore, coeff, latent, explained, mu, ems = pca(X; DT::DataType=Float32, npc=0)
X
: A n-by-p data matrix X. Rows of X correspond to observations and columns correspond to variables. Must be a Float type (either 32 or 64).npc
: The number of eigenvectors used to construct the solution. Its value must be in the range [1, npc]. The defaultnpc=0
means we use the full solution, that is npc = p. Use this option whenX
is big and you want to save some resources (time, memory) by not computing components that will have a very small explained variance.DT
: The Data Type. Internally, the algorithm makes a copy of the inputX
matrix because it will be modified.DT
controls what type that copy will assume. $Float32$ or $Float64$? By default, we use the same data type as inX
, but for big matrices it may be desirable to use $Float32$ if that saves memory. Note: the default is different in the methods referred below, where it defaults to $Float32$ because image data is almost always $UInt8$ or $UInt16$ and grids are $Float32$.
Returns
score
: The principal components.coeff
: The principal component coefficients for the matrix X. Rows of X correspond to observations and columns correspond to variables. The coefficient matrix is npc-by-n. Each column of coeff contains coefficients for one principal component, and the columns are in descending order of component variance.latent
: The principal component variances. (The eigenvalues of cov(X))explained
: The percentage of the total variance explained by each principal component.mu
: The mean of each variable in X.ems
: The mean square error incurred in using only thenpc
eigenvectors corresponding to the largest eigenvalues.ems
is 0 if npc = n (the default).
Ipca = pca(I::GMTimage; DT::DataType=Float32, npc=0) -> GMTimage{UInt8}
This method takes a $GMTimage$ cube, normally satellite data of $UInt16$ type created with the $RemoteS$ package, and returns a $GMTimage$ cube of $UInt8$ of the principal components in decreasing order of explained variance. The $truecolor(Ipca)$ (from $RemoteS$) will show a false color image made of the three largest components.
Gpca = pca(G::GMTgrid; DT::DataType=Float32, npc=0) -> GMTgrid{DT}
This method takes a $GMTgrid$ cube and returns another grid, of type DT
($Float32$ by default), with principal components in decreasing order of explained variance.
GMT.pcolor
— Functionpcolor(X, Y, C::Matrix{<:Real}; kwargs...)
Creates a colored cells plot using the values in matrix C
. The color of each cell depends on the value of each value of C
after consulting a color table (cpt). If a color table is not provided via option cmap=xxx
we compute a default one.
X
,Y
: Vectors or 1 row matrices with the x- and y-coordinates for the vertices. The number of elements ofX
must match the number of columns inC
(is using the grid registration model) or exceed it by one (pixel registration). The same forY
and the number of rows inC
. Notice thatX
andY
do not need to be equispaced.X
,Y
: Matrices with the x- and y-coordinates for the vertices. In this case the ifX
andY
define an m-by-n grid, thenC
should be an (m-1)-by-(n-1) matrix, though we also allow it to be m-by-n but we then drop the last row and column fromC
C
: A matrix with the values that will be used to color the cells.kwargs
: This form ofpcolor
is in fact a wrap up of $plot$ so any option of that module can be used here.labels
: If this $keyword$ is used then we plot the value of each node in the corresponding cell. Uselabel=n
, where $n$ is integer and represents the number of printed decimals. Any other value like $true$, $"y"$ or $:y$ tells the program to guess the number of decimals.font
: Whenlabel
is used one may also control text font settings. Options are a subset of the $text$attrib
option. Namely, the angle and the $font$. Example: $font=(angle=45, font=(5,:red))$. If not specified, it defaults to $font=(font=(6,:black),)$.
D = pcolor(X, Y; kwargs...)
This form, that is without a color matrix, accepts X
and Y
as before but returns the tiles in a vector of GMTdatasets. Use the kwargs
option to pass for example a projection setting (as for example $proj=:geo$).
pcolor(G::GMTgrid; kwargs...)
This form takes a grid (or the file name of one) as input an paints it's cell with a constant color.
outline
: Draw the tile outlines and specify a custom pen if the default pen is not to your liking.kwargs
: This form ofpcolor
is a wrap of $grdview$ so any option of that module can be used here. One can for example control the tilling option via $grdview's$ $tiles$ option.
Examples
# Create an example grid
G = GMT.peaks(N=21);
pcolor(G, outline=(0.5,:dot), show=true)
# Now use the G x,y coordinates in the non-regular form
pcolor(G.x, G.y, G.z, show=true)
# Add labels to cells using default settings (font size = 6p)
pcolor(G.x, G.y, G.z, labels=:y, show=true)
# Similar to above but now set the number of decimlas in labels as well as it font settings
pcolor(G.x, G.y, G.z, labels=2, font=(angle=45, font=(5,:red)), show=1)
# An irregular grid
X,Y = meshgrid(-3:6/17:3);
XX = 2*X .* Y; YY = X.^2 .- Y.^2;
pcolor(XX,YY, reshape(repeat([1:18; 18:-1:1], 9,1), size(XX)), lc=:black, show=true)
GMT.pip
— Methodin = pip(x, y, polygon::Matrix)
or
in = pip(point::VecOrMat, polygon::Matrix)
Returns in
indicating if the query points specified by x
and y
are inside of the polygon area defined by polygon
where polygon
is an Mx2 matrix of reals that should have the first and last elements equal.
Returns:
- in = 1
- on = 0
- out = -1
Reference
GMT.pix2axes
— Methodxc, yc = pix2axes(xy::Matrix{<:Int}, x, y)
Convert pixel/cell to axes coordinates
xy
: A Mx2 matrix with indices referring to thex
andy
vectorsx
,y
: Vectors of monotonically and regular growing coordinates
Return two vectors of same type as that of x,y
GMT.plot
— Methodplot(arg1::Array; kwargs...)
reads (x,y) pairs from files [or standard input] and generates PostScript code that will plot lines, polygons, or symbols at those locations on a map.
See full GMT (not the GMT.jl
one) docs at psxy
Parameters
- A | steps | stairs | straight_lines :: [Type => Str]
By default, geographic line segments are drawn as great circle arcs.
To draw them as straight lines, use this option.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
D | shift | offset :: [Type => Str]
Offset the plot symbol or line locations by the given amounts dx/dy in cm, inch or points.
E | error | error_bars :: [Type => Str]
Draw symmetrical error bars.
F | conn | connection :: [Type => Str]
Alter the way points are connected
G | fill | markerfacecolor | MarkerFaceColor | markercolor | mc :: [Type => Str]
Select color or pattern for filling of symbols or polygons. BUT WARN: the alias 'fill' will set the color of polygons OR symbols but not the two together. If your plot has polygons and symbols, use 'fill' for the polygons and 'markerfacecolor' for filling the symbols. Same applyies for W bellow
I | intens :: [Type => Str | number]
Use the supplied intens value (in the [-1 1] range) to modulate the fill color by simulating illumination.
L | close | polygon :: [Type => Str]
Force closed polygons.
N | no_clip | noclip :: [Type => Str or []]
Do NOT clip symbols that fall outside map border
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
S | symbol | marker | Marker :: [Type => Str]
Plot symbols (including vectors, pie slices, fronts, decorated or quoted lines). Alternatively select a sub-set of symbols using the aliases: marker or Marker and values:
- -, x_dash
- +, plus
- a, *, star
- c, circle
- d, diamond
- g, octagon
- h, hexagon
- i, v, inverted_tri
- n, pentagon
- p, ., point
- r, rectangle
- s, square
- t, ^, triangle
- x, cross
- y, y_dash
and select their sizes with the markersize or size keyword [default is 7p]. The marker size can be a scalar or a vector with same size numeber of rows of data. Units are points unless specified otherwise with (for example for cm) par=(PROJLENGTHUNIT="c")
W | pen | markeredgecolor | mec :: [Type => Str]
Set pen attributes for lines or the outline of symbols WARNING: the pen attributes will set the pen of polygons OR symbols but not the two together. If your plot has polygons and symbols, use W or pen for the polygons and markeredgecolor for filling the symbols. Similar to S above.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
Z | level :: [Type => Str | NamedTuple]
Arg = value|file[+f|+l] | (data=Array|Number, outline=_, fill=_)
Paint polygons after the level given as a cte or a vector with same size of number of polygons. Needs a color map.
aspect :: [Type => Str]
When equal to "equal" makes a square plot.
a | aspatial :: [Type => Str] $Arg = [col=]name[…]$
Control how aspatial data are handled in GMT during input and output.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
GMT.plot3d
— Methodplot3d(arg1::Array; kwargs...)
reads (x,y,z) triplets and generates PostScript code that will plot lines, polygons, or symbols at those locations in 3-D.
See full GMT (not the GMT.jl
one) docs at plot3d
Parameters
A | steps | straight_lines :: [Type => Str]
By default, geographic line segments are drawn as great circle arcs. To draw them as straight lines, use this option.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
Jz | zscale | zsize :: [Type => String]
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color :: [Type => Str]
Give a CPT or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
D | offset :: [Type => Str]
Offset the plot symbol or line locations by the given amounts dx/dy.
E | error_bars :: [Type => Str]
Draw symmetrical error bars.
F | conn | connection :: [Type => Str]
Alter the way points are connected
G | fill | markerfacecolor | MarkerFaceColor | markercolor | mc :: [Type => Str]
Select color or pattern for filling of symbols or polygons. BUT WARN: the alias 'fill' will set the color of polygons OR symbols but not the two together. If your plot has polygons and symbols, use 'fill' for the polygons and 'markerfacecolor' for filling the symbols. Same applyies for W bellow
I | intens :: [Type => Str or number]
Use the supplied intens value (in the [-1 1] range) to modulate the fill color by simulating illumination.
L | closed_polygon :: [Type => Str]
Force closed polygons.
N | no_clip :: [Type => Str | []]
Do NOT clip symbols that fall outside map border
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
S | symbol | marker | Marker :: [Type => Str]
Plot symbols (including vectors, pie slices, fronts, decorated or quoted lines). Alternatively select a sub-set of symbols using the aliases: marker or Marker and values:
- -, x_dash
- +, plus
- a, *, star
- c, circle
- d, diamond
- g, octagon
- h, hexagon
- i, v, inverted_tri
- n, pentagon
- p, ., point
- r, rectangle
- s, square
- t, ^, triangle
- x, cross
- y, y_dash
W | pen | line_attribs | markeredgecolor | MarkerEdgeColor | mec:: [Type => Str] Set pen attributes for lines or the outline of symbols WARNING: the pen attributes will set the pen of polygons OR symbols but not the two together. If your plot has polygons and symbols, use W or line_attribs for the polygons and markeredgecolor or MarkerEdgeColor for filling the symbols. Similar to S above.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
Z | level :: [Type => Str | NamedTuple]
Arg = value|file[+f|+l] | (data=Array|Number, outline=_, fill=_)
Paint polygons after the level given as a cte or a vector with same size of number of polygons. Needs a color map.
a | aspatial :: [Type => Str] $Arg = [col=]name[…]$
Control how aspatial data are handled in GMT during input and output.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
Example:
plot3d(x -> sin(x)*cos(10x), y -> sin(y)*sin(10y), z -> cos(z), 0:pi/100:pi, show=true, aspect3=:equal)
GMT.plot_GI_size
— Functionw, h = plot_GI_size(GI, proj="", region="")
Compute the plot width and height in cm given the the region region
and projection proj
. Note that here the region
and proj
options, if provided, must be the full " -R...." and " -J..." strings and the later MUST contain the figure width too. If any of those is empty we get/estimate them from the GI
limits, where GI
is either a grid or an image. For this we use a default value of 15c but this value is not particularly important because the main idea here is to be able to compute the H/W ratio.
Returns a tuple of Float64 with the width, height in cm.
GMT.plotgrid!
— Methodplotgrid!(GI, grid; annot=true, sides="WESN", fmt="", figname="", show=false)
Plot grid lines on top of an image created with the worldrectangular
function.
GI
: A GMTgrid or GMTimage data type.grid
: A vector of GMTdatset with meridians and parallels to be plotted. This is normaly produced by thegraticules()
orworldrectgrid()
functions.annot
: Wether to plot coordinate annotations or not (annot=false
).sides
: Which sides of plot to annotate.W
orL
means annotate the left side and so on for any combination of "WESNLRBT". To not annotate a particular side just omit that character. e.g.sides="WS"
will annotate only the left and bottom axes.figname
: To create a figure in local directory and with a namefigname
. Iffigname
has an extension that is used to select the fig format. e.g.figname=fig.pdf
creates a PDF file localy called 'fig.pdf'fmt
: Create the raster figure in formatformat
. Default isfmt=:png
. To get it in PDF dofmt=:pdf
show
: Iftrue
, finish and display the figure.
GMT.plotlinefit
— Methodplotlinefit(D::GMTdataset, kwargs...)
Plot the line fit of the points in the D
GMTdataset type incliding confidence intervals ann error ellipses. The D
input is the result of having run your data through the linearfitxy
function. See its docs for the meaning of the parameters mentioned below.
band_ab
orribbon_ab
: Plot a band,(a±σa) + (b±σb)
, around the fitted line.band_ab=true
uses the defaultlightblue
color. Useband_ab=*color*
to paint it with a color of your choice (this color may include transparency)band_ci
orribbon_ci
: Plot a band,(a±σa95) + (b±σb95)
, with the 95% (or other Confidence Interval).band_ci=true
uses the defaulttomato
color. Useband_ci=*color*
to paint it with a color of your choice (transparency included).ellipses
: optionaly plot error ellipses when theσX,
σY` errors are known.legend
: By default we do not plot the legend boxes with line fit info. Setlegend=rue
to plot them. For the time being the legend locations are determine automaticaly and can't be manually controlled.``lc or linecolor
: By default the fitted line is plotted withred
color. Uselc=*color*
to change it.lt, lw or linethickness
: By default the fitted line thickness is set to0.5
. Uselt=*thickness*
to change it.
Other than the above options you can use most of the plot
options that control line and marker symbol.
Examples:
plotlinefit(D, band_ab=true, band_ci=true, legend=true, show=1)
GMT.plotyy
— Methodplotyy(arg1, arg2; kwargs...)
Example:
plotyy([1 1; 2 2], [1.5 1.5; 3 3], R="0.8/3/0/5", title="Ai", ylabel=:Bla, xlabel=:Ble, seclabel=:Bli, show=1)
GMT.pol2cart
— Methodx, y = pol2cart(theta, rho; deg=false)
Transform polar to Cartesian coordinates. Angles are in radians by default. Use deg=true
if angles are in degrees. Input can be scalar, vectors or matrices.
GMT.polyfit
— Functionp = polyfit(x, y, n=length(x)-1; xscale=1)
Returns the coefficients for a polynomial p(x) of degree n
that is the least-squares best fit for the data in y. The coefficients in p are in ascending powers, and the length of p is n+1.
The xscale
parameter is useful when needing to get coeeficients in different x units. For example when converting months or seconds into years.
GMT.polygonlevels
— Methodzvals = polygonlevels(D::GDtype, ids::Vector{String}, vals::Vector{<:Real}; kw...) -> Vector{Float64}
or
zvals = polygonlevels(D::GDtype, ids::Matrix{String}, vals::Vector{<:Real}; kw...) -> Vector{Float64}
Creates a vector with zvals
to use in plot
and where length(zvals) == length(D) The elements of zvals
are made up from the vals
.
ids
: is a string Vector or Matrix with the ids (attribute names) of the GMTdataset D. If a Matrix (2 columns only) then theatt
bellow must also have the two names (string vector with two elements) that will be matched against the two elements of each line ofids
. The idea here is to match two conditions:att[1] == ids[n,1] && att[2] == ids[n,2]
vals
: is a vector with the numbers to be used in plotlevel
to color the polygons.attrib
oratt
: keyword to select which attribute to use when matching with contents of theids
strings.nocase
orinsensitive
: a keyword fromkw
. Perform a case insensitive comparision between the contents ofids
and the attribute specified withattrib
. Default compares as case sensistive.repeat
: keyword to replicate the previously known value until it finds a new segment ID for the case when a polygon have no attributes (may happen for the islands in a country).
Returns a Vector{Float64} with the same length as the number of segments in D. Its content are made up from the contents of vals
but may be repeated such that each polygon of the same family, i.e. with the same ids
, has the same value.
GMT.polyval
— Methody = polyval(p::AbstractArray, x::Union{AbstractArray, Number})
Evaluates the polynomial p at each point in x. The argument p is a vector of length n+1 whose elements are the coefficients (in ascending order of powers) of an nth-degree polynomial:
GMT.princomp!
— Methodscore, coeff, latent, explained, mu, ems = princomp!(X, q=0)
X
: A n-by-p data matrix X. Rows of X correspond to observations and columns correspond to variables. Must be a Float type (either 32 or 64).q
: The number of eigenvectors used to construct the solution. Its value must be in the range [1, p]. The defaultq=0
means we use the full solution, that is q = p.
Returns
score
: The principal componentscoeff
: The principal component coefficients for the matrix X. Rows of X correspond to observations and columns correspond to variables. The coefficient matrix is q-by-n. Each column of coeff contains coefficients for one principal component, and the columns are in descending order of component variance.latent
: The principal component variances. (The eigenvalues of cov(X))explained
: The percentage of the total variance explained by each principal component.mu
: The mean of each variable in X.ems
: The mean square error incurred in using only theq
eigenvectors corresponding to the largest eigenvalues.ems
is 0 if q = n (the default).
Note, this function follows approximately the Matlab one and has influences of a similar function in the Digital Image Processing Using MATLAB book.
GMT.proj2wkt
— Methodproj2wkt(proj4_str::String, pretty::Bool=false)
Convert a PROJ4 string into the WKT form. Use pretty=true
to return a more human readable text.
GMT.project
— Functionproject(cmd0::String="", arg1=nothing, kwargs...)
Project data onto lines or great circles, generate tracks, or translate coordinates.
See full GMT (not the GMT.jl
one) docs at project
Parameters
C | origin | start_point :: [Type => list/tuple] $Arg = (x,y)$
Sets the origin of the projection, in Definition 1 or 2.
A | azim | azimuth :: [Type => Number] $Arg = azimuth$
Defines the azimuth of the projection (Definition 1).
E | end_pt | endpoint :: [Type => list/tuple] $Arg = (bx,by)$
bx,by defines the end point of the projection path (Definition 2).
F | outvars :: [Type => Str] $Arg = xyzpqrs$
Specify your desired output using any combination of xyzpqrs, in any order [Default is xyzpqrs].
G | step | generate :: [Type => Number or list/tuple– $Arg = dist[/colat][+h]$
Generate mode. No input is read. Create (r, s, p) output points every dist units of p. See Q option.
L | length :: [Type => Number or list/tuple] $Arg = [w|l_{min}/l_{max}]$
Length controls. Project only those points whose p coordinate is within l_min < p < l_max.
N | flat_earth :: [Type => Bool or []]
Flat Earth. Make a Cartesian coordinate transformation in the plane. [Default uses spherical trigonometry.]
Q | km :: [Type => Bool or []]
Map type units.
S | sort :: [Type => Bool or []]
Sort the output into increasing p order. Useful when projecting random data into a sequential profile.
T | pole :: [Type => list/tuple] $Arg = (px,py)$
px,py sets the position of the rotation pole of the projection. (Definition 3).
W | width :: [Type => list/tuple] $Arg = (w_{min},w_{max})$
Width controls. Project only those points whose q coordinate is within w_min < q < w_max.
Z | ellipse :: [Type => Number | Tuple | String] $Arg = major/minor/azimuth[+e|n]$
Make ellipse with major and minor axes given in km (unless N is given for a Cartesian ellipse) and the azimuth of the major axis in degrees; used in conjunction with origin (sets its center) and step (sets the distance increment).
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
s | skiprows | skip_NaN :: [Type => Str] $Arg = [cols][a|r]$
Suppress output for records whose z-value equals NaN.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? project$
GMT.psconvert
— Functionpsconvert(cmd0::String="", arg1=nothing; kwargs...)
Place images or EPS files on maps.
See full GMT (not the GMT.jl
one) docs at psconvert
Parameters
A | adjust | crop :: [Type => Str or Number]
Adjust the BoundingBox and HiResBoundingBox to the minimum required by the image content.
C | gs_option :: [Type => Str or Array os strings]
Specify a single, or an araay of, custom option that will be passed on to GhostScript as is.
D | out_dir | output_dir :: [Type => Str]
Sets an alternative output directory (which must exist) [Default is the same directory as the PS files].
E | dpi :: [Type => Number]
Set raster resolution in dpi [default = 720 for PDF, 300 for others].
F | :out_name | output_name :: [Type => Str]
Force the output file name.
G | ghost_path :: [Type => Bool]
Full path to your GhostScript executable.
I | resize :: [Type => Bool]
Adjust the BoundingBox and HiResBoundingBox by scaling and/or adding margins.
in_memory :: [Type => Bool]
Process a in memory PS file. No other input file should be provided. Currently works on Windows only.
L | list_file :: [Type => Str]
The listfile is an ASCII file with the names of the PostScript files to be converted.
M | embed
Sandwich the current psfile between an optional background (-Mb) and optional foreground (-Mf) Postscript plots.
N | bgcolor
Set optional BoundingBox background fill color, fading, or draw the outline of the BoundingBox.
Q | anti_aliasing :: [Type => Str]
Set the anti-aliasing options for graphics or text. Append the size of the subsample box (1, 2, or 4) [4]. This option is set by default.
S | gs_command :: [Type => Bool]
Print to standard error the GhostScript command after it has been executed.
T | format :: [Type => Str]
b|e|E|f|F|j|g|G|m|s|t Sets the output format, where b = BMP, e = EPS, E = EPS with PageSize command, f = PDF, F = multi-page PDF, j = JPEG, g = PNG, G = transparent PNG (untouched regions are transparent), m = PPM, and t = TIFF [default is JPEG]. Alternatively, the format may be set with the fmt keyword, e.g. fmt=:png.
W | world_file :: [Type => Str]
Write a ESRI type world file suitable to make (e.g) .tif files be recognized as geotiff by software that know how to do it.
kml :: [Type => Str | []]
Create a minimalist KML file that allows loading the image in GoogleEarth.
Z | delinputps :: [Type => Bool]
Remove the input PostScript file(s) after the conversion.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
To see the full documentation type: $@? psconvert$
GMT.put_pocket_call
— Methodput_pocket_call(val)
Put VAL in the next empty slot in the pocket_call vector. So far only 2 slots
GMT.qqnorm
— Methodqqnorm(x; qqline=:identity, kwargs...)
The qqnorm is a qqplot
shorthand for comparing a distribution to the normal distribution. If the distributions are similar the points will be on a straight line.
GMT.qqplot
— Methodqqplot(x::AbstractVector{AbstractFloat}, y::AbstractVector{AbstractFloat}; kwargs...)
The qqplot function compares the quantiles of two distributions.
qqline
: determines how to compute a fit line for the Q-Q plot. The options areidentity
: draw the line y = x (the deafult).fit
: draw a least squares line fit of the quantile pairs.fitrobust
orquantile
: draw the line that passes through the first and third quartiles of the distributions.none
: do not draw any line.
Broadly speaking,
qqline=:identity
is useful to see if x and y follow the same distribution, whereasqqline=:fit
andqqline=:fitrobust
are useful to see if the distribution of y can be obtained from the distribution of x via an affine transformation.For fine setting of the line and scatter points use the same options as in the
plot
module.
Examples:
qqplot(randn(100), randn(100), show=true)
qqplot(randn(100), show=true)
GMT.quadbounds
— FunctionDtiles, zoomL = quadbounds(quadtree; flatness=0.0, geog=true)
Compute the coordinates of the quadtree
quadtree. Either a single quadtree string or an array of quadtree strings.
quadtree
: Either a single quadtree string or aMatrix{String}
of quadtree strings. This is the quadtree string or array of strings to compute coordinates for and is obtained from a call to themosaic
using thequadonly
option (see example below).flaness
: Flatness of the ellipsoid.
Returns
Dtiles
: A GMTdataset vector with the corner coordinates of each tile.zoomL
: Zoom level of the tiles.
Example
quadtree = mosaic([-10. -8],[37. 39.], zoom=8, quadonly=1)[1];
D = quadbounds(quadtree)[1];
viz(D)
GMT.quadkey
— Methodquadkey(lon::Real, lat::Real, zoom::Int; bounds=false, geog=true)
bounds
: If true, returns the bounding box of the tile, otherwise returns the tile XYZ coordinates and the quadtree string.geog
: return the bounding box in geographic coordinates. If false, returns the bounding box in spherical Mercator coordinates
Returns the x,y,z & the quadtree string or the bounds
Examples
julia> quadkey(-9,39, 8)
([121, 97, 8], ["03311003";;])
julia> quadkey(-9,39, 8, bounds=true)
2×2 Matrix{Float64}:
-9.84375 38.8226
-8.4375 39.9097
The form bellow returns the quadtree representation of the XYZ tile or the bounds coordinates in geographic coordinates
quadkey(xyz::VecOrMat{<:Int}; bounds=true, geog=true)
Examples
julia> quadkey([121, 97, 8], bounds=false)
"03311003"
GMT.radar
— Methodradar(cmd0="", arg1=nothing; axeslimts=Float64[], annotall=false, axeslabels=String[], kwargs...)
Radar plots are a useful way for seeing which variables have similar values or if there are outliers amongst each variable. By default we expect a matrix, or a GMTdatset (or a vector of them) with normalized values. This is so because a radar plot has multiple axis that each have different limits. So the options are to pass normalized variables or set each axis limits via the axeslimts
option.
axeslimts
: A vector with the same size as columns in the input matrix with the max extent of each variable. NOTE that if you don't provide this option we assume input data is normalized.annotall
: By default only the first axis is annotated, which is all it needs when variables are normalized. However, when using non-normalized variables it may be useful to show the limits of each axis.axeslabels
orlabels
: String vector with the names of each variable axis. Plots a default "Label?" if not provided.
By default the polygons are not filled but that is often not so nice. To fill with the default cyclic color use just fill=true
. Other options are to use:
fill
orfillcolor
: A string vector with polygon colors. If number of colors is less then number of polygons we cycle through the number of provided colors.fillalpha
: The default is to paint polygons with a transparency of 70%. For other transparency values pass in a vector of transparencies (between [0-1] or ]1-100]) via this option.lw
orpen
: Sets the outline pen settings (default is line thickness '= 1 pt' with same color as polygon's)
Examples:
radar([0.5 0.5 0.6 0.9 0.77; 0.6 0.5 0.8 0.2 0.9], show=true, marker=:circ, fill=true)
radar([10.5 20.5 30.6 40.9 46], axeslimts=[15, 25, 50, 90, 50], labels=["Spoons","Forks","Knifes","Dishes","Oranges"],
annotall=true, marker=:circ, fill=true, show=1)
GMT.randgeo
— Methodlon, lat = randgeo(n; rad=false, limits=nothing, do360=false)
Generate random longitude and latitude coordinates.
By default the coordinates are in degrees and in the [-180 180] range. Set do360
to true
to get the coordinates in the [0 360] range. Set rad
to true
to get the coordinates in radians instead of degrees.
Optionally, you can pass a 4-element array or tuple with the limits of the coordinates. limits
must then contain the lonmin, lonmax, latmin, latmax of the region where you want to generate random points.
GMT.randinpolygon
— MethodD = randinpolygon(Din; density=0.1, np::Int=0)
Generate random samples inside polygons. The method used here is that of poin-in-polygon. That is, we generate random points inside a rectangular BoundingBox of each polygon and retain those inside the polygon. For geographical polygons we generate random angles but do NOT connect the polygon sides with great circles, so solution is not really geographic but the error is rather small if the polygon vertices are close to each other.
Din
: The input polygons. It can be a $GMTdaset$, a vector of them or a Mx2 matrix with the polygon vertices.density
: the average density of the randomly generated points. For the Cartesian case this is a percentage that can be expressed in the ]0 1] or ]0 100] interval. For example, the defaultdensity=0.1
means that points are created more or less at 1/10th of polygon's side. For geographical polygons (identified by theproj
fields of theGMTdataset
) thedensity
means number of points per degree. The default of 20 represents a point scattering of about 1 every 5 km.np
: The approximate number of points in each polygon. Note that this option overridesdensity
and is not an exact requirement. That isnp=10
might return 9 or 11 or other number of points.
Returns
A GMTdatset if only one polygon was passed or a Vector{GMTaset} otherwise.
GMT.rasters2grid
— MethodG = rasters2grid(arg; scale=1, offset=0)
Deals with Rasters.jl arrays (grids and cubes). The input argument was previously detected (by israsters) to be a Rasters.jl type. The input array is not copied when it has no 'missings' but is often modified when replacing abstruse missingval by NaN. And given that the type is immutable we cannot change the arg.missingval
and hence some checks # will be repeated everytime this function is run. So the best is to call $G = mat2grid(arg)$ once and use G
Returns a GMTgrid type.
GMT.rasterzones!
— Methodrasterzones!(GI::GItype, shapes::Vector{GMTdataset}, fun::Function; touches=false, byfeatures::Bool=false, groupby="")
or
rasterzones!(fun::Function, GI::GItype, shapes::Vector{GMTdataset}; touches=false, byfeatures::Bool=false, groupby="")
Apply a unidimensional function fun
to to the elements of the grid or image GI
that lie inside the polygons of the GMTdataset shapes
. The GI
array is modified in place.
Arguments
GI
: A grid (GMTgrid) or image (GMTimage) type that will be modified by applyingfun
to the elements that fall inside the polygons ofshapes
.shapes
: A vector of GMTdataset containing the polygons inside which the elements ifGI
will be assigned a single value obtained by applying the functionfun
.fun
: A unidemensional function name used to compute the contant value for theGI
elements that fall inside each of the polygons ofshapes
.
Parameters
touches
: include all cells/pixels that are touched by the polygons. The default is to include only the cells whose centers that are inside the polygons.byfeatures
: Datasets read from OGR vector files (shapes, geopackages, arrow, etc) are organized in features that may contain several geomeometries each. Each group of geometries in a Feature share the sameFeauture_ID
atribute. Ifbyfeatures
is true, the functionfun
will be applied to each feature independently. This option is actually similar to thegroupby
parameter but doesn't require an attribute name. If neither ofbyfeatures
orgroupby
are provided, thefun
function is applied to each of the polygons independently.groupby
: If provided, it must be an attribute name, for example,groupby="NAME"
. If not provided, we use theFeature_ID
attribute that is a unique identifier assigned during an OGR file reading (by the GMT6.5 C lib). If neither ofbyfeatures
orgroupby
are provided, thefun
function is applied to each of the polygons independently.
See also: colorzones!
Returns
It does't return anything but the input GI
is modified.
Example
Take the Peaks grid and replace the elements that fall inside a triangle at the center by their average.
G = GMT.peaks();
D = mat2ds([-1 -1; 0 1; 1 -1; -1 -1]);
rasterzones!(G, D, mean)
GMT.rasterzones
— MethodGI = rasterzones(GI::GItype, shapes::GDtype, fun::Function; touches=false)
or
GI = rasterzones(fun::Function, GI::GItype, shapes::GDtype; touches=false)
Compute the statistics of fun
applied to the elements of the grid or image GI
that lie inside the polygons of the GMTdataset shapes
. See the rasterzones!
documentation for more details. The difference is that this function returns a new grid/image instead of changing the input.
GMT.read_obj
— MethodVF = read_obj(fname)
Read a Wavefront .obj file and return the result in a FaceVertices object.
GMT.readgeom
— Methodreadgeom(wkt::String; gdataset::Bool=false)
wkt
: A string with the a geometry encoded as a WKT stringgdataset
: If set totrue
forces the return of a GDAL dataset instead of a GMT type.
Returns
A GMTdataset or a GDAL dataset
Examples
D = readgeom("POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0))")
GMT.readgeom
— MethodD = readgeom(wkt::Vector{String})
Return a vector of GMTdatasets from a vector of WKT strings.
GMT.rect_overlap
— Methodoverlap, value = rect_overlap(xc_1, yc_1, xc_2, yc_2, width1, height1, width2, height2) -> Bool, Float64
Checks if two rectangles, aligned with the axes, overlap.
xc_1, yc_1
: Center of the first rectanglexc_2, yc_2
: Center of the second rectanglewidth1, height1
: Width and height of the first rectanglewidth2, height2
: Width and height of the second rectangle
Returns:
overlap
: True if there is overlap, false if there is no overlapvalue
: The degree of overlap or non-overlap
GMT.regiongeog
— Methodregiongeog(GI)::Tuple
Returns a tuple with (lonmin, lonmax, latmin, latmax) of the projected GI
object limits converted to geographic coordinates. Returns an empty tuple if GI
has no registered referencing system. GI
can either a GMTgrid
, a GMTimage
or a file name (String) of one those types.
GMT.regress
— Functionregress(cmd0::String="", arg1=nothing, kwargs...)
Linear regression of 1-D data sets.
See full GMT (not the GMT.jl
one) docs at regress
Parameters
A | all_slopes :: [Type => Str | List] $Arg = min/max/inc$
Instead of determining a best-fit regression we explore the full range of regressions.
C | ci | cl | confidence_level :: [Type => Int] $Arg = level$
Set the confidence level (in %) to use for the optional calculation of confidence bands on the regression [95].
E | regression_type :: [Type => Str] $Arg = x|y|o|r$
Type of linear regression, i.e., select the type of misfit we should calculate.
F | column_combination :: [Type => Str] $Arg = x|y|m|l|c$
Append a combination of the columns you wish returned;
N | norm :: [Type => Str | Int] $Arg = 1|2|r|w$
Selects the norm to use for the misfit calculation.
S | restrict :: [Type => Str | []] $Arg = [r]$
Restricts which records will be output.
T | equi_space :: [Type => Str | List] $Arg = [min/max/]inc[+a|n]] or file|list$
Evaluate the best-fit regression model at the equidistant points implied by the arguments.
W | weighted :: [Type => Str | []] $Arg = [w][x][y][r]$
Specifies weighted regression and which weights will be provided.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
GMT.replicateline
— MethodGMT.rescale
— FunctionR = rescale(A, a=0.0, b=1.0; inputmin=nothing, inputmax=nothing, stretch=false, type=nothing)
A
: is either a GMTgrid, GMTimage, Matrix{AbstractArray} or a file name. In later case the file is read with a call togmtread
that automatically decides how to read it based on the file extension ... not 100% safe.rescale(A)
rescales all entries of an arrayA
to [0,1].rescale(A,b,c)
rescales all entries of A to the interval [b,c].rescale(..., inputmin=imin)
sets the lower boundimin
for the input range. Input values less thanimin
will be replaced withimin
. The default is min(A).rescale(..., inputmax=imax)
sets the lower boundimax
for the input range. Input values greater thanimax
will be replaced withimax
. The default is max(A).rescale(..., stretch=true)
automatically determines [inputmin inputmax] via a call to histogram that will (try to) find good limits for histogram stretching. The formstretch=(imin,imax)
allows specifying the input limits directly.type
: Converts the scaled array to this data type. Valid options are all Unsigned types (e.g.UInt8
). Default returns the same data type asA
if it's an AbstractFloat, or Flot64 ifA
is an integer.
Returns a GMTgrid if A
is a GMTgrid of floats, a GMTimage if A
is a GMTimage and type
is used or an array of Float32|64 otherwise.
GMT.rgb2YCbCr
— MethodYCbCr = rgb2YCbCr(I::GMTimage{UInt8, 3}; Y=false, Cb=false, Cr=false, BT709=false)
or
Y,Cb,Cr = rgb2YCbCr(I::GMTimage{UInt8, 3}; Y=false, Cb=false, Cr=false, BT709=false)
Converts RGB color values to luminance (Y) and chrominance (Cb and Cr) values of a YCbCr image.
Optionally, return only one to three of Y, Cb and Cr in separate images. For that use the keywords
: Y=true
, Cb=true
or Cr=true
. Each $true$ occurence makes it return that component, otherwise it returns an empty image.
The BT709
option makes it use the $ITU-R BT.709$ conversion instead of the default $ITU-R BT.601$. See https://en.wikipedia.org/wiki/YCbCr
Examples
Iycbcr = rgb2YCbCr(mat2img(rand(UInt8, 100, 100, 3)) # A 3D image
_,Cb,Cr = rgb2YCbCr(mat2img(rand(UInt8, 100, 100, 3), Cb=true, Cr=true) # The Cb and Cr components
Cb = rgb2YCbCr(mat2img(rand(UInt8, 100, 100, 3), Cb=true)[2] # The Cb component
GMT.rgb2gray
— MethodIgray = rgb2gray(I) -> GMTimage
Converts an RGB image to a grayscale image applying the television YMQ transformation.
GMT.rgb2lab
— Methodimg = rgb2lab(I::GMTimage{UInt8, 3})
or
L, a, b = rgb2lab(I::GMTimage{UInt8, 3}, L=true)
Convert RGB to CIE 1976 Lab*
Optionally, return three images with the L, a* and b* components. For that use the option L=true
GMT.rose
— Methodrose(cmd0::String="", arg1=nothing; kwargs...)
Reads (length,azimuth) pairs and plot a windrose diagram (polar histograms).
See full GMT (not the GMT.jl
one) docs at psrose
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
A | sector | sectors :: [Type => Str | Number]
Gives the sector width in degrees for sector and rose diagram.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | color :: [Type => Str | GMTcpt]
Give a CPT. The mid x-value for each bar is used to look-up the bar color.
- E | vectors :: [Type => Str]
Plot vectors showing the principal directions given in the mode_file file.
- D | shift :: [Type => Bool]
Shift sectors so that they are centered on the bin interval (e.g., first sector is centered on 0 degrees).
- F | no_scale :: [Type => Bool]
Do not draw the scale length bar [Default plots scale in lower right corner].
- G | fill :: [Type => Str | Number]
Selects shade, color or pattern for filling the sectors [Default is no fill].
- I | inquire :: [Type => Bool]
Inquire. Computes statistics needed to specify a useful -R. No plot is generated.
- L | labels :: [Type => Str | Number]
Specify labels for the 0, 90, 180, and 270 degree marks.
- M | vector_params :: [Type => Str]
Used with -C to modify vector parameters.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | alpha :: [Type => Str | []]
Sets the confidence level used to determine if the mean resultant is significant.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | norm | normalize :: [Type => Bool]
Specifies radius of plotted circle (append a unit from c|i|p).
- T | orientation :: [Type => Bool]
Specifies that the input data are orientation data (i.e., have a 180 degree ambiguity)
instead of true 0-360 degree directions [Default].
- W | pen :: [Type => Str | Tuple]
Set pen attributes for sector outline or rose plot. [Default is no outline].
- Z | scale :: [Type => Str]
Multiply the data radii by scale.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? rose$
GMT.round_datetime
— MethodRound a Vector or Tuple (2 elements) of DateTime type to a nearest nice number to use in plot limits
GMT.sample1d
— Methodsample1d(cmd0::String="", arg1=nothing, kwargs...)
Resample 1-D table data using splines
See full GMT (not the GMT.jl
one) docs at sample1d
Parameters
A | resample :: [Type => Str] $Arg = f|p|m|r|R$
For track resampling (if -T…unit is set) we can select how this is to be performed.
E | keeptext :: [Type => Bool]
If the input dataset contains records with trailing text then we will attempt to add these to output records that exactly match the input times.
F | interp :: [Type => Str] $Arg = l|a|c|n|s<p>[+1|+2]$
Choose from l (Linear), a (Akima spline), c (natural cubic spline), and n (no interpolation: nearest point) [Default is Akima].
N | time_col :: [Type => Int] $Arg = t_col$
Indicates which column contains the independent variable (time). The left-most column is # 0, the right-most is # (n_cols - 1). [Default is 0].
T | inc | range :: [Type => List | Str] $Arg = [min/max/]inc[+a|n]] or file|list$
Evaluate the best-fit regression model at the equidistant points implied by the arguments.
cumdist
|cumsum
: [Type => Bool]Compute the cumulative distance along the input line. Note that for this the first two columns must contain the spatial coordinates.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | weights :: [Type => Int] $Arg = w_col$
Sets the column number of the weights to be used with a smoothing cubic spline. Requires Fs.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? sample1d$
GMT.scan_opt
— Functionstr = scan_opt(cmd::AbstractString, opt::String, keepX=false)
Scans the CMD string for the OPT option. Note, OPT must be a 2 chars -X GMT option. 'keepX' retains the OPT 2 chars -X GMT option in output.
Example
scan_opt(" -Baf", "-B", true)
" -Baf"
GMT.scatter
— Functionscatter(cmd0::String="", arg1=nothing; kwargs...)
Reads (x,y) pairs and plot symbols at those locations on a map. This module is a subset of $plot$ to make it simpler to draw scatter plots. So many of its (fine) controling parameters are not listed here. For a finer control, user should consult the $plot$ module.
Parameters
G | fill | markerfacecolor :: [Type => Str]
Select color or pattern for filling of symbols or polygons.
N | noclip | no_clip :: [Type => Str | []]
Do NOT clip symbols that fall outside map border
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
S :: [Type => Str]
Plot symbols (including vectors, pie slices, fronts, decorated or quoted lines).
Alternatively select a sub-set of symbols using the aliases: symbol or marker and values:
- -, x_dash
- +, plus
- a, *, star
- c, circle
- d, diamond
- g, octagon
- h, hexagon
- i, v, inverted_tri
- n, pentagon
- p, ., point
- r, rectangle
- s, square
- t, ^, triangle
- x, cross
- y, y_dash
and select their sizes with the **markersize** or **size** keyword [default is 8p].
The marker size can be a scalar or a vector with same size numeber of rows of data. Units are
points unless specified otherwise with (for example for cm) *par=(PROJ_LENGTH_UNIT=:c,)*
W | pen | markeredgecolor | mec :: [Type => Str]
Set pen attributes for lines or the outline of symbols
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
GMT.sealand
— Methodsealand(f1::Function, arg1, t1::NamedTuple, f2::Function, arg2, t2::NamedTuple; kw...)
and
terramar(f1::Function, arg1, t1::NamedTuple, f2::Function, arg2, t2::NamedTuple; kw...)
The $sealand/terramar$ pair of functions intended to simplify the task of mapping one field (grid or image) at the ocean side and another different field (also a grid or image) over land. To achieve this result, we resort to the $coast$ module and its ability to clip the dry and wet parts of the Earth. In the first function, $sealand$ we pass first the module name and the data that is going to be plotted over the oceanic areas, and second the module and data over land. The second function, $terramar$ does the opposit.
f1
: The name of the module that will be used to plot the data. Normally, this should be either $grdimage$ or $grdview$, but $plot$ can in principle be used as well.arg1
: The input data to be used by thef1
module. Normally, a $GMTgrid$, a $GMTimage$, a $GMTdatset$ or a string with the file name of the data to use.t1
: A NamedTuple with the keyword=value pairs of the options to be consumed byf1
.f2
: Likef1
but to be applied toarg2
.arg2
: Likearg1
but forf2
.t2
: Liket1
but forf2
.
Other than the above options, we can pass in kw
options to be consumed in the $coast$ module and that will result in, for example, plotting the coastlines with pen color, thickness, style, etc... controls. Use it also to instruct this program to finish the figure and display it (the familiar $show=true$), or to save the figure under a different name/format, e.g. $figname="blabla.pdf"$.
Example: reproduce the GMT Illustration Gallery example 17.
Cgeoid = grd2cpt("@india_geoid.nc");
Cgray = makecpt(cmap=150, range="-10000,10000", nobg=true);
sealand(grdimage, "@india_geoid.nc", (region="@india_geoid.nc", shade="+d", proj=:Merc,
cmap=Cgeoid, title="Clipping of Images"),
grdimage, "@india_topo.nc", (shade="+d", cmap=Cgray), shore=0.5)
colorbar!(pos=(inside=true, anchor=:TR, offset=(0.8,0.2), size=(10,0.5), horizontal=true),
cmap=Cgeoid, xaxis=(annot=5, ticks=1), ylabel=:m, shade=true, show=true)
GMT.searchdir
— Methodnames = searchdir(path, template_name) -> Vector{String}
Search in directory path
for files starting with template_name
. Returns a vector with the names.
GMT.seislegend
— Methodseislegend(; title="", font=(16,"Times-Roman"), cmap=GMTcpt(), mags=Float64[], lowermag=3, kw...)
Adds a legend to plots produced by seismicity
function. All options are optional.
cmap
: A colormap (CPT) with either 3 or 4 colors only. This is used to paint symbols according to depth layer.mags
: The seizes in cm for the magnitudes 3 to 9.title
: The legend head title.font
: The legend head font.
GMT.seismicity
— Methodseismicity(starttime="", endtime="", minmagnitude=3, mindepth=0, maxdepth=0, last=0, year=0, printurl=false, show=true, kw...)
Make automatic maps of of world-wide seismicity obtained from the USGS Earthquake Hazards Program page at https://earthquake.usgs.gov
starttime
: Limit to events on or after the specified start time. NOTE: All times use ISO8601 Date/Time format OR a DateTime type. Default is NOW - 30 days.endtime
: Limit to events on or before the specified end time. Same remarks as forstarttime
. Default is present time.minmagnitude
: Limit to events with a magnitude larger than the specified minimum.mindepth
: Limit to events with depth more than the specified minimum (km positive down).maxdepth
: Limit to events with depth less than the specified maximum (km positive down).last
: If value is an integer (e.g.last=90
), select the events in the last n days. If it is a string than we expect that it ends with a 'w'(eek), 'm'(onth) or 'y'(ear). Example:last="2Y"
(period code is caseless)year
: An integer, restrict data download to this year.printurl
: Print the url of the requested data.circle
: A 3 elements Tuple or Array with $lon,lat,radius$, where $radius$ is in km, to perform a circle search.data
: The default is to make a seismicity map but if thedata
option is used (containing whatever) we return the data in a $GMTdataset$figname
: savefig | figname | name :: [Type => Str]Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")land
: By default we paint the continents with the "burlywood" color. Like in the $coast$ module, useland=
"othercolor" to replace it.layers
: By default we divide depth into three layers; 1-100, 100-300 and > 300 km, Uselayers=4
to subdivide top layer into 0-50 and 50-100 km.legend
: By default we plot a legend. Particular options for the legend command (e.g.pos
,box
, etc) are passed via thekw...
options. Uselegend=false
to have no legend.ocean
: By default we paint the oceans with the "lightblue" color. Useocean=
"othercolor" to replace it.region
: The region of interest. By default it is [-180 180 -90 90] but one may pass a sub-region like all other modules that accept this option (e.g. $coast$)proj
: By default we select an appropriate projection based on theregion
extents, but that may be overridden by specifying aproj=xxx
like, for example, in $coast$.size
: Can be a scalar to plot all events with same size. This size is expected to be in cm but > 1 it is interpreted to be in points.size=[min_sz max_sz]
will scale linearly min/max magnitude to have sizesmin_sz/max_sz
size=([min_sz max_sz], [min_mag max_mag])
will scale linearlymin_mag/max_mag
magnitude to have sizesmin_sz/max_sz
size=(fun, [min_sz max_sz] [, [min_mag max_mag]])
does the same as above but the transformation is determined by the function 'fun'. Possibles functions are $exp10$, $exp$, $pow$ and $sqrt$. In the $pow$ case we must pass in also the exponent and the syntax is:size=((pow,2), [min_sz max_sz])
to have a square scaling.
show
: By default this function shows the plot (when nodata
option). Useshow=false
to prevent that (and leave the figure open to accept more plots from posterior commands.)
Examples
seismicity(size=8)
seismicity(marker=:star, size=[3 10])
seismicity(size=(exp10, [2 12], [3 9]))
GMT.setcoords!
— Methodsetcoords!(GI::GItype; x::Vector{<:Real}=Float64[], y::Vector{<:Real}=Float64[], registration::Int=0)
Assign x,y coordinates to a GMTgrid or GMTimage. The x,y
arguments are mandatory and can be two elements vectors with [xmin, xmax] and [ymin, ymax] respectively or vectors with ncolumns and nrows if registration=0
or with ncolumns+1 and nrows+1 if registration=1
.
Return
This function returns nothing as what it does is to change the object coordinates information. See also the setsrs!
function.
GMT.setfld!
— Methodsetfld!(D, kwargs...)
Sets fields of GMTdataset (or a vector of it), GMTgrid and GMTimage. Field names and field values are transmitted via kwargs
Example: setfld!(D, geom=wkbPolygon)
GMT.setnodata!
— Methodsetnodata!(G::GMTgrid, nodata) -> nothing
Replace all grid values with nodata
in a GMTgrid by NaN. Operates only on float grids. It doesn't return anything but will change the underlying array. Useful to fix grids that have been read from sources that didn't care to set up a nodata value (for example nc/hdf grids with no _FillValue).
GMT.setsrs!
— Methodsetsrs!(GID::Union{GItype, GDtype}; prj::String="", proj::String="", proj4::String="", wkt::String="", epsg::Int=0)
or
setcrs!(GID::Union{GItype, GDtype}; prj::String="", proj::String="", proj4::String="", wkt::String="", epsg::Int=0)
Set the spatial reference of a GMTgrid, GMTimage or GMTdataset(s). Pass one or more of the ways to reference the grid/image/dataset objects. Note that if you pass more than one way, the rest of the information is redundant and should not be contradictory.
prj
,proj
orproj4
: Aliases for passing a PROJ4 string.wkt
: A WKT (Well Known Format) string.epsg
: A EPSG code.
Return
This function returns nothing as what it does is to add/change the object referencing information.
GMT.settimecol!
— Methodsettimecol!(D::GDtype, Tcol)
Set the time column in the dataset D (or vector of them). Tcol
is either an Int scalar or vector of Ints with the column number(s) that hold the time columns.
GMT.showfig
— Functionshowfig([fmt="format", figname="figname[.fmt]"])
Finish the PostScript file and convert&display the figure.
fmt
: Create the raster figure in formatformat
. Default isfmt=:png
. To get it in PDF dofmt=:pdf
figname
: To create a figure in local directory and with a namefigname
. Iffigname
has an extension, that is used to select the fig format. e.g.figname=fig.pdf
creates a PDF file localy called 'fig.pdf'
GMT.sideplot
— Methodsideplot(; plane=:xz, vsize=8, depth=NaN, kw...)
Lower level function, normaly only called by cubeplot
, that plots an image on one side of a cube.
GMT.skipnan
— MethodReturn an ierator over data skipping non-finite values
GMT.slicecube
— Methodslicecube(I::GMTimage, layer::Union{Int, AbstractVector{<:Int}})
Take a slice of a multylayer GMTimage. Return the result still as a GMTimage. layer
is the z slice number.
slicecube(G::GMTgrid, slice::Union{Int, AbstractVector{<:Int}}; axis="z")
Extract a slice from a GMTgrid cube.
slice
: If it is an Int it will return a GMTgrid corresponding to that layer. However, ifslice
is a float this is interpreted to mean: search that dimension (see theaxis
below) coordinates and find the closest layer that has coordinate =slice
. If theslice
value is not within 10% of the coordinate of closest layer, the returned layer is obtained by linear interpolation of the neighboring layers. For example,slice=2.5
on a cube were layers are one unit apart will interpolate between layers 2 and 3 where each layer weights 50% in the end result. NOTE: the return type is still a cube but with one layer only (and the corresponding axis coordinate).slice
Can also be a vector of integers representing the slices we want to extract. The output is another cube.axis
: denotes the dimension being sliced. The default, "z", means the slices are taken from the vertical axis.axis="x"
means slice along a column, andaxis="y"
slice along a row.
slicecube(GI::GItype; slice::Int=0, angle=0.0, axis="x", cmap=GMTcpt())
Take a slice of a GMTgrid or GMTimage in an oblique direction. Take the cube's layer slice
and rotate it by angle
degrees about the axis
. This one can only be axis=:x
or axis=:y
. Depending on the data type of input a different output is produces. If GI
is a GMTgrid, the output is 2 GMTgrids: one with z
levels and the other with cube's z levels along that plane. On the other hand, if GI isa GMTimage the first output is similar to previus case but the second will be a GMTimage. In this case the cmap
option may be used to assign a colortable to the image type.
The value at the slice point, P(x[i,j], y[i,j], z[i, j)), is the interpolated value of the two nearest voxels on the same vertical.
Example
Get the fourth layer of the multi-layered 'I' GMTimage object
I = slicecube(I, 4)
GMT.sniff_inset_coords
— Methodlimits = sniff_inset_coords(fname, opt_R, opt_J) -> Matrix(4x4)
Sniff in the session's gmt.inset.0 file and extract the inset limits in data units.
GMT.solar
— Functionsolar(cmd0::String="", arg1=nothing; kwargs...)
Calculate and plot the day-night terminator and the civil, nautical and astronomical twilights.
See full GMT (not the GMT.jl
one) docs at solar
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | format :: [Type => Bool]
G | fill :: [Type => Str | Number]
I | sun :: [Type => Bool | Tuple | NamedTuple]
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
M | dump :: [Type => Bool]
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
N | invert :: [Type => Bool]
T | terminators :: [Type => Bool | Tuple | NamedTuple]
W | pen :: [Type => Str | Tuple]
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
o | outcols | outcol :: [Type => Str] $Arg = cols[,…]$
Select specific data columns for primary output, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? solar$
GMT.sortslicesperm
— Methodp = sortslicesperm(A; dims=1, kws...)
Like sortslices
but return instead the indices p
such that A[p, :] == sortslices(A; dims=1, kws...)
GMT.spectrum1d
— Methodgmtspectrum1d(cmd0::String="", arg1=nothing, kwargs...)
Compute auto- [and cross- ] spectra from one [or two] time-series.
See full GMT (not the GMT.jl
one) docs at spectrum1d
Parameters
S | size :: [Type => Str] $Arg = segment_size$
$segment_size$ is a radix-2 number of samples per window for ensemble averaging.
C | outputs :: [Type => Str | []] $Arg = [xycnpago]$
Read the first two columns of input as samples of two time-series, X(t) and Y(t). Consider Y(t) to be the output and X(t) the input in a linear system with noise.
D | sample_dist :: [Type => Number] $Arg = dt$
Set the spacing between samples in the time-series [Default = 1].
L | leave_trend :: [Type => Str | []] $Arg = [h|m]$
Leave trend alone. By default, a linear trend will be removed prior to the transform.
N | name :: [Type => Int] $Arg = t_col$
Indicates which
T :: [Type => Bool]
Disable the writing of a single composite results file to stdout.
W | wavelength :: [Type => Bool | Str]
Write Wavelength rather than frequency in column 1 of the output file[s] [Default = frequency, (cycles / dt)].
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
write | |> :: [Type => Str] $Arg = fname$
Save result to ASCII file instead of returning to a Julia variable. Give file name as argument. Use the bo option to save as a binary file.
append :: [Type => Str] $Arg = fname$
Append result to an existing file named $fname$ instead of returning to a Julia variable. Use the bo option to save as a binary file.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? spectrum1d$
GMT.sph2cart
— Methodx, y, z = sph2cart(az, elev, rho; deg=false)
Transform spherical coordinates to Cartesian. Angles are in radians by default. Use deg=true
if angles are in degrees. Input can be scalar, vectors or matrices.
GMT.sphdistance
— Functionsphdistance(cmd0::String="", arg1=nothing, kwargs...)
Create Voronoi distance, node, or natural nearest-neighbor grid on a sphere
See full GMT (not the GMT.jl
one) docs at sphdistance
Parameters
C | save_mem :: [Type => Bool]
For large data sets you can save some memory (at the expense of more processing).
D | duplicates :: [Type => Bool]
Delete any duplicate points [Default assumes there are no duplicates].
E | quantity :: [Type => Str] $Arg = d|n|z[dist]$
Specify the quantity that should be assigned to the grid nodes.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = sphdistance(....) form.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
L | dist_unit :: [Type => Str] $Arg = d|e|f|k|M|n|u$
Specify the unit used for distance calculations.
N | nodes :: [Type => Str] $Arg = nodes$
Read the information pertaining to each Voronoi polygon (the unique node lon, lat and polygon area) from a separate file.
Q | voronoi :: [Type => Str] $Arg = voronoifile$
Append the name of a file with pre-calculated Voronoi polygons.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? sphdistance$
GMT.sphinterpolate
— Functionsphinterpolate(cmd0::String="", arg1=nothing, kwargs...)
Spherical gridding in tension of data on a sphere
See full GMT (not the GMT.jl
one) docs at sphinterpolate
Parameters
D | skipdup :: [Type => Bool]
Delete any duplicate points [Default assumes there are no duplicates].
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = sphinterpolate(....) form.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
Q | tension :: [Type => Number | Str] $Arg = mode[/options]$
Specify one of four ways to calculate tension factors to preserve local shape properties or satisfy arc constraints.
T | var_tension :: [Type => Bool | Str]
Use variable tension (ignored with -Q0 [constant]
Z | scale :: [Type => Bool | Str]
Before interpolation, scale data by the maximum data range [no scaling].
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? sphinterpolate$
GMT.sphtriangulate
— Functionsphtriangulate(cmd0::String="", arg1=nothing, kwargs...)
Delaunay or Voronoi construction of spherical lon,lat data
See full GMT (not the GMT.jl
one) docs at sphtriangulate
Parameters
A | area :: [Type => Bool]
Compute the area of the spherical triangles (Qd) or polygons (Qv) and write the areas in the output segment headers
C | save_mem :: [Type => Bool]
For large data sets you can save some memory (at the expense of more processing).
D | skipdup :: [Type => Bool]
Delete any duplicate points [Default assumes there are no duplicates].
L | unit :: [Type => Str] $Arg = e|f|k|m|n|u|d$
Specify the unit used for distance and area calculations.
N | nodes :: [Type => Str] $Arg = `file$
Write the information pertaining to each polygon to a separate file.
Q | voronoi :: [Type => Str] $Arg = d|v$
Append d for Delaunay triangles or v for Voronoi polygons [Delaunay].
T | arcs :: [Type => Bool | Str]
Write the unique arcs of the construction [Default writes fillable triangles or polygons]. When used with -A we store arc length in the segment header in chosen unit.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? sphtriangulate$
GMT.splitds
— Methodv, names = splitds(D::Vector{<:GMTdataset}; groupby::String="") --> Tuple{Vector{Vector{Int}}, Vector{String}}
Compute the indices that split a vector of datasets into groups. The grouping is done either by a provided attribute name (groupby
) or by the FeatureID attribute. This function is mostly used internally by `zonalstatistics`
D
: A vector of GMTdatasetgroupby
: If provided, it must be an attribute name, for example,groupby="NAME"
. If not provided, we use theFeature_ID
attribute that is a unique identifier assigned during an OGR file reading (by the GMT6.5 C lib). If theFeature_ID
attribute does not exist, you must use a valid attribute name passed ingroupby
. If neither of those exists, an error is thrown.
Returns
v
: A Vector{Vector{Int}} with the indices that split the datasets into groups. The length ofv
is the number of groups found and each element ofv
is a vector of indices that belong to that group.names
: A Vector{String} with the names of the groups. These names are fetched from the attributes. It will be the values of the attribute name provided bygroupby
or those of the first attribute value if that option is not used.
GMT.squeeze
— MethodGs = squeeze(G::GMTgrid) -> GMTgrid
Remove singleton dimension from a grid. So far only for vertical slices of 3D grids.
GMT.stackgrids
— Functionstackgrids(names::Vector{String}, v=nothing; zcoord=nothing, zdim_name="time",
z_unit="", save="", mirone=false)
Stack a bunch of single grids in a multiband cube like file.
names
: A string vector with the names of the grids to stackv
: A vector with the vertical coordinates. If not provided, one with 1:length(names) will be generated.- If
v
is a TimeType use thez_unit
keyword to select what to store in file (case insensitive).decimalyear
oryeardecimal
converts the DateTime to decimal years (Floa64)milliseconds
(or justmil
) will store the DateTime as milliseconds since 0000-01-01T00:00:00 (Float64)seconds
stores the DateTime as seconds since 0000-01-01T00:00:00 (Float64)unix
stores the DateTime as seconds since 1970-01-01T00:00:00 (Float64)rata
stores the DateTime as days since 0000-12-31T00:00:00 (Float64)Date
orDateTime
stores as a string representation of a DateTime.
- If
zdim_name
: The name of the vertical axes (default is "time")zcoord
: Keyword same asv
(may use one or the other).save
: The name of the file to be created.mirone
: Does not create a cube file but instead a file named "automatic_list.txt" (or whaterversave=xxx
) to be used in the MironeEmpilhador
tool.
GMT.stairs
— Functionstairs(cmd0::String="", arg1=nothing; step=:post, kwargs...)
Plot a stair function. The step
parameter can take the following values:
:post
- The default. Lines move first along x for cartesian plots or the parallels for geographic and then along y or the meridians. :pre
- Lines move first along y for cartesian plots or the meridians for geographic and then along x or the parallels.
Example:
x = linspace(0, 4*pi, 50);
stairs(x, sin.(x), show=true)
GMT.stem
— Functionstem(cmd0::String="", arg1=nothing; kwargs...)
Example:
Y = linspace(-2*pi,2*pi,50);
stem([Y Y], show=true)
stem(Y,[Y -Y], multicol=true, fill=true, show=true)
GMT.streamlines
— MethodS = streamlines(U::GMTgrid, V::GMTgrid, startX, startY; step=0.1, max_vert::Int=10000)
Compute 2-D streamlines as a 2-D matrix (in fact, a GMTdataset) of vector fields. The inputs U
and V
are GMTgrids with the x
and y
velocity components, and startX
and startY
are the starting positions of the streamlines. step
is the step size in data units for interpolating the vector data and max_vert
is the maximum number of vertices in a streamline. startX
and startY
can both be scalars, vectors or one a scalar and the other a vector. Returns a Vector{GMTdataset} with the streamlines.
S = streamlines(U::GMTgrid, V::GMTgrid, D::GMTdataset; step=0.1, max_vert::Int=10000)
In this method the streamlines starting positions are fetch from the 2 columns of the D
argument. Returns a Vector{GMTdataset} with the streamlines.
S, A = streamlines(U::GMTgrid, V::GMTgrid; step=0.1, max_vert::Int=10000)
Method that computes automatically spaced streamlines from 2D grids U and V. Returns the streamlines in the S
Vector{GMTdataset} and A
holds the positions along the streamlines where to plot arrow-heads if wished.
S = streamlines(U::GMTgrid, V::GMTgrid; side::Union{String, Symbol}="left", step=0.1, max_vert::Int=10000)
Here we auto-generate the starting positions along one of the 4 sides of the grid. Select the wished side with the side
keyword. Returns a Vector{GMTdataset} with the streamlines.
S = streamlines(x, y, U::Matrix, V::Matrix, sx, sy; step=0.1, max_vert::Int=10000)
This last 2D method let users pass the x
and y
vector data coordinates, U and V are matrices with the velocity data and the remaining arguments have the same meaning as in the other methods. Returns a Vector{GMTdataset} with the streamlines.
S = streamlines(x::Matrix, y::Matrix, U::Matrix, V::Matrix; step=0.1, max_vert::Int=10000)
x
and y
are assumed to be meshgrids with the x and y starting coordinates.
S = streamlines(U::GMTgrid, V::GMTgrid, W::GMTgrid, startX, startY, startZ; step=0.1, max_vert::Int=10000)
Conpute 3D volume of vector fields with streamline. Here U
,V
and W
are 3D cubes with x,y,z
velocity components. startX
, startY
and startZ
can be scalar or vector coordinate arrays. Returns a Vector{GMTdataset} with the streamlines.
Example
x,y = GMT.meshgrid(-10:10);
u = 2 .* x .* y;
v = y .^2 - x .^ 2;
U = mat2grid(u, x[1,:], y[:,1]);
V = mat2grid(v, x[1,:], y[:,1]);
r,a = streamlines(U, V);
plot(r, decorated=(locations=a, symbol=(custom="arrow", size=0.3), fill=:black, dec2=true), show=1)
GMT.subTriSplit
— FunctionFV = subTriSplit(FV::Vector{<:GMTdataset}, n=1)
V, F = subTriSplit(V, F, n=1)
Splits the triangulation defined by the faces F, and the vertices V, n times. Each triangle is linearly split into 4 triangles with each iterations.
First mode ingests a two elements vector of GMTdataset where first contains the vertices and the second the indices that define the faces and returns a same type. The second mode expects the vertices and faces as two separate arrays (but it also accepts GMTdatasets) and returns two matrices with the vertices and faces.
n
: is the number of times the triangulation is split.
GMT.subplot
— Functionsubplot(fim=nothing; kwargs...)
Manage figure subplot configuration and selection.
See full GMT (not the GMT.jl
one) docs at subplot
Parameters
grid :: [Type => Str | Tuple | Array]
Specifies the number of rows and columns of subplots. Ex grid=(2,3)
F | dims | dimensions | size | sizes :: [Type => Str | Tuple, NamedTuple]
Specify the dimensions of the figure.
A | autolabel | fixedlabel :: [Type => Str | number]
Specify automatic tagging of each subplot. This sets the tag of the first, top-left subplot and others follow sequentially.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | clearance :: [Type => Str | number]
Reserve a space of dimension clearance between the margin and the subplot on the specified side. Settings specified under begin directive apply to all panels.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
M | margin | margins :: [Type => Str]
The margin space that is added around each subplot beyond the automatic space allocated for tick marks, annotations, and labels.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
SC | SR | col_axes | row_axes :: [Type => Str | NamedTuple]
Set subplot layout for shared axes. Set separately for rows (SR) and columns (SC).
T | title :: [Type => Str]
While individual subplots can have titles, the entire figure may also have a overarching title.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
GMT.surface
— Functionsurface(cmd0::String="", arg1=nothing; kwargs...)
Reads randomly-spaced (x,y,z) triples and produces a binary grid file of gridded values z(x,y) by solving:
(1 - T) * L (L (z)) + T * L (z) = 0
See full GMT (not the GMT.jl
one) docs at surface
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
A | aspect_ratio :: [Type => Number]
Aspect ratio. If desired, grid anisotropy can be added to the equations.
C | convergence :: [Type => Number]
Convergence limit. Iteration is assumed to have converged when the maximum absolute change in any grid value is less than convergence_limit.
D | breakline :: [Type => String | NamedTuple]
Arg = breakline[+z[level]] | (data=Array, [zlevel=x])
Use xyz data in the breakline file as a ‘soft breakline’, that is a line whose vertices will be used to constrain the nearest grid nodes without any further interpolation.
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = surface(....) form.
Ll | lower :: [Type => Str | Number]
Impose limits on the output solution. lower sets the lower bound. lower can be the name of a grid file with lower bound values, a fixed value, d to set to minimum input value,
Lu | upper :: [Type => Str | Number]
M | mask :: [Type => Number]
Arg = max_radius
After solving for the surface, apply a mask so that nodes farther than max_radius away from a data constraint is set to NaN.
N | iterations | max_iterations :: [Type => Number]
Number of iterations. Iteration will cease when convergencelimit is reached or when number of iterations reaches maxiterations.
Q | suggest :: [Type => Bool]
Suggest grid dimensions which have a highly composite greatest common factor.
S | search_radius :: [Type => Number | Str]
Sets the resolution of the projected grid that will be created.
T | tension :: [Type => Number | Str]
Tension factor[s]. These must be between 0 and 1.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | log :: [Type => Str]
Write convergence information to a log file [surface_log.txt].
Z | over_relaxation :: [Type => Str | GMTgrid]
Over-relaxation factor. This parameter is used to accelerate the convergence; it is a number between 1 and 2.
preproc :: [Type => Bool | Str/Symb]
This option means that the data is previously passed through one of $block*$ modules to decimate the data in each cell as strongly advised.
preproc=true
will use $blockmean$. To use any of the other two, pass its name as value. e.g.preproc="blockmedian"
.a | aspatial :: [Type => Str] $Arg = [col=]name[…]$
Control how aspatial data are handled in GMT during input and output.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? surface$
GMT.tern2cart
— Functiontern2cart(abcz::Matrix{<:Real}, reverse::Bool=false)
Converts ternary to cartesian units.
abcz
is either a Mx3 (a,b,c) or Mx4 (a,b,c,z) matrix
GMT.ternary
— Functionternary(cmd0="", arg1=nothing; image=false, clockwise=false, kwargs...)
Reads (a,b,c[,z]) records from table [or file] and plots image and symbols at those locations on a ternary diagram.
B | frame :: [Type => NamedTuple | Str] –
For ternary diagrams the three sides are referred to as a (bottom), b (right), and c (left). The default is to annotate and draw grid lines but without labeling the axes. But since labeling is a very important feature, you can use the
labels
option that take as argument a 3 elements Tuple with the labels of the 3 axes. Further control on annotations and grid spacing (on/off) is achieved by using theframe=(annot=?, grid=?, alabel=?, blabel=?, clabel=?, suffix=?)
form. Note that not all options of the generalframe
options are accepted in this module and for more elaborated frame option selection you will have to resort to the pure GMT syntax in the formframe="<arg> <arg> <arg>"
C | color | colormap | cmap | colorscale :: [Type => Str] $Arg = [cpt |master[+izinc] |color1,color2[,*color3*,…]]$
Give a CPT name or specify -Ccolor1,color2[,color3,...] to build a linear continuous CPT from those colors automatically.
G | fill :: [Type => Str] –
Select color or pattern for filling the bars
L | vertex_labels :: [Type => Str | Tuple of strings] –
Arg = a/b/c
Set the labels for the three diagram vertices where the component is 100% [none].
M | dump :: [Type => Str]
Dumps the converted input (a,b,c[,z]) records to Cartesian (x,y,[,z]) records, where x, y are normalized coordinates on the triangle (i.e., 0–1 in x and 0–sqrt(3)/2 in y). No plotting occurs.
N | no_clip | noclip :: [Type => Str or []]
Do NOT clip symbols that fall outside map border
R | region | limits :: [Type => Tuple | Str]
Give the min and max limits for each of the three axis a, b, and c. Default is (0,100,0,100,0,100)
S | symbol :: [Type => Str]
Plot individual symbols in a ternary diagram. If
S
is not given then we will instead plot lines (requirespen
) or polygons (requirescolor
orfill
).Alternatively select a sub-set of symbols using the aliases: symbol or marker and values:
- -, x_dash
- +, plus
- a, *, star
- c, circle
- d, diamond
- g, octagon
- h, hexagon
- i, v, inverted_tri
- n, pentagon
- p, ., point
- r, rectangle
- s, square
- t, ^, triangle
- x, cross
- y, y_dash
and select their sizes with the markersize or size keyword [default is 8p]. The marker size can be a scalar or a vector with same size numeber of rows of data. Units are points unless specified otherwise with (for example for cm) par=(PROJLENGTHUNIT=:c,)
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
W | pen :: [Type => Str | Number]
Sets the attributes for the particular line.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
q | inrow | inrows :: [Type => Str] $Arg = [i|o][~]rows[+ccol][+a|f|s]$
Select specific data rows to be read (-qi [Default]) or written (-qo) [all].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
Other than the above options, the kwargs
input accepts still the following options
image
: - Fills the ternary plot with an image computed automatically withgrdimage
from a grid interpolated withsurface
contour
: - This option works in two different ways. If used together withimage
it overlays a contour by doing a call togrdcontour
. However, if used alone it will callcontour
to do the contours. The difference is important because this option can be used in default mode withcontour=true
where the number and annotated contours is picked automatically, or the use can exert full control by passing as argument a NamedTuple with all options appropriated to that module. e.g.contour=(cont=10, annot=20, pen=0.5)
contourf
: - Works a bit like the standalonecontour
. If used withcontourf=true
call make a filled contour using automatic parameters. The formcontourf=(...)
let us selects options of the contourf module.clockwise
: - Set it totrue
to indicate that positive axes directions be clock-wise [Default lets the a, b, c axes be positive in a counter-clockwise direction].
GMT.tetrahedron
— FunctionFV = tetrahedron(r=1.0)
Creates a tetrahedron mesh with radius r
.
GMT.text
— Functiontext(cmd0::String="", arg1=nothing; kwargs...)
Plots text strings of variable size, font type, and orientation. Various map projections are provided, with the option to draw and annotate the map boundaries.
See full GMT (not the GMT.jl
one) docs at pstext
Parameters
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
A | azimuth | azim :: [Type => Bool]
Angles are given as azimuths; convert them to directions using the current projection.
C | clearance :: [Type => Str]
Sets the clearance between the text and the surrounding box [15%].
D | offset :: [Type => Str]
Offsets the text from the projected (x,y) point by dx,dy [0/0].
F | attrib :: [Type => Str | Tuple]
Specify up to three text attributes (font, angle, and justification).
G | fill :: [Type => Str | Number]
Sets the shade or color used for filling the text box [Default is no fill].
Jz | zscale | zsize :: [Type => String]
L | list :: [Type => Bool]
Lists the font-numbers and font-names available, then exits.
M | paragraph :: [Type => Str | []]
Paragraph mode.
N | no_clip | noclip :: [Type => Str | []]
Do NOT clip text at map boundaries.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
Q | change_case :: [Type => Str]
Change all text to either lower or upper case.
S | shade :: [Type => Str | Tuple | Bool] $Arg = [dx/dy][/shade]$
Plot an offset background shaded region beneath the text box (GMT6.2).
T | text_box :: [Type => Str]
Specify the shape of the textbox when using G and/or W.
W | pen :: [Type => Str]
Sets the pen used to draw a rectangle around the text string.
Z | threeD :: [Type => Str]
For 3-D projections: expect each item to have its own level given in the 3rd column.
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
a | aspatial :: [Type => Str] $Arg = [col=]name[…]$
Control how aspatial data are handled in GMT during input and output.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
g | gap :: [Type => Str] $Arg = [a]x|y|d|X|Y|D|[col]z[+|-]gap[u]$
Examine the spacing between consecutive data points in order to impose breaks in the line.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? pstext$
GMT.texture_img
— Methodtexture_img(G::GMTgrid; detail=1.0, contrast=2.0, intensity=false)
Compute the Texture Shading calling functions from the software from Leland Brown at http://www.textureshading.com/Home.html
G
: The $GMTgrid$ from which to compute the Leland texture illumination image.detail
is the amount of texture detail. Lower values of detail retain more elevation information, giving more sense of the overall, large structures and elevation trends in the terrain, at the expense of fine texture detail. Higher detail enhances the texture but gives an overall "flatter" general appearance, with elevation changes and large structure less apparent.contrast
is a parameter called “vertical enhancement.” Higher numbers increase contrast in the midtones, but may lose detail in the lightest and darkest features. Lower numbers highlight only the sharpest ridges and deepest canyons but reduce contrast overall.intensity | uint16
controls if output is a UInt16 or a UInt8 image (the default). Note that the original code writes only UInt16 images but if we want to combine this with the hillshade computed with $gdaldem$, a UInt8 image is more handy.
Returns
A UInt8 (or 16) GMT Image
GMT.theme
— Functiontheme(name; kwrgs...)
Offer themes support. NAME is the theme name. So far the three options are:
modern
: - This is the default theme (same as GMT modern theme but with thinner FRAME_PEN [0.75p])classic
: - The GMT classic themedark
: - A modern theme variation with dark background.A0|2[XY|XX|YY][atg][ag][g][H][V][NT|nt][ITit][Graph][Dark]
Make a composition of these to select a theme. The main condition is that it starts with an A (Annotate). HenceA2
means annotate two axis andA0
means no axes at all.XY
means to plot only left and bottom axes,YY
only left and right andXX
bottom and top.atg
(orafg
) means annotate, tick and grid lines.ag
does not tick.H
andV
means grid lines will only be horizontal or vertical. Note, these requireatg
orag
.NT
stands for no ticks at all andIT
plots the ticks inside the axes.Graph
adds a vector to the end of each axis (setsXY
), andDark
put the background in dark mode.- Example:
A2YYg
-> plot left and right axes (only) and add grid lines. - Example:
A2Graph
-> plot left and right axes (only) and adds arrows at the end of them
- Example:
On top of the modern mode variations (so far dark
only) one can set the following kwargs
options:
noticks
orno_ticks
: Axes will have annotations but no tick marksinner_ticks
orinnerticks
: - Ticks will be drawn inside the axes instead of outside.gray_grid
orgraygrid
: - When drawing grid line usegray
instead ofblack
save
: - Save the name in the directory printed byGMT.GMTuserdir[1]
and make it permanent.reset
: - Remove the saved theme name and return to the defaultmodern
theme.
Note: Except save
and reset
, the changes operated by the kwargs
are temporary and operate only until an image is show
(n) or saved.
This function can be called alone, e.g. theme("dark")
or as an option in the plot()
module.
GMT.togglemask
— MethodI = togglemask(I::Union{GMTimage{<:Bool, 2}, GMTimage{<:UInt8, 2}}) -> GMTimage
Convert between UInt8 and Boolean representations of the mask images. A new object is returned but the underlying mask matrix is kept unchanged, that is, not copied, but reinterpred in the other type.
GMT.trend1d
— Functiontrend1d(cmd0::String="", arg1=nothing, kwargs...)
Fit a [weighted] [robust] polynomial/Fourier model for y = f(x) to xy[w] data.
See full GMT (not the GMT.jl
one) docs at trend1d
Parameters
F | out | output :: [Type => Str] $Arg = xymrw|p|P|c$
Specify up to five letters from the set {x y m r w} in any order to create columns of output.
N | model :: [Type => Str] $Arg = [p|P|f|F|c|C|s|S|x]n[,…][+llength][+oorigin][+r]$
Specify Specify the number of terms in the model, n_model, and append +r to do a robust fit. E.g., a robust bilinear model is -N4+r.
C | condition_number :: [Type => Number] $Arg = condition_number$
Set the maximum allowed condition number for the matrix solution.
I | conf_level :: [Type => Number | []] $Arg = [confe_level]$
Iteratively increase the number of model parameters, starting at one, until nmodel is reached or the reduction in variance of the model is not significant at the conflevel level.
W | weights :: [Type => Str | []] $Arg = [+s]$
Weights are supplied in input column 3. Do a weighted least squares fit [or start with these weights when doing the iterative robust fit].
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? trend1d$
GMT.trend2d
— Functiontrend2d(cmd0::String="", arg1=nothing, kwargs...)
Fit a [weighted] [robust] polynomial model for z = f(x,y) to xyz[w] data.
See full GMT (not the GMT.jl
one) docs at trend2d
Parameters
F | out | output :: [Type => Str] $Arg = xyzmrw|p$
Specify up to five letters from the set {x y m r w} in any order to create columns of output.
N | model :: [Type => Str] $Arg = n_model[+r]$
Specify the number of terms in the model, n_model, and append +r to do a robust fit. E.g., a robust bilinear model is N="4+r".
C | condition_number :: [Type => Number] $Arg = condition_number$
Set the maximum allowed condition number for the matrix solution.
I | conf_level :: [Type => Number | []] $Arg = [confidence_level]$
Iteratively increase the number of model parameters, starting at one, until nmodel is reachedx or the reduction in variance of the model is not significant at the confidencelevel level.
W | weights :: [Type => Str | []] $Arg = [+s]$
Weights are supplied in input column 4. Do a weighted least squares fit [or start with these weights when doing the iterative robust fit].
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
b | binary :: [Type => Str]
d | nodata :: [Type => Str or Number] $Arg = [i|o]nodata$
Control how user-coded missing data values are translated to official NaN values in GMT.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? trend2d$
GMT.triangulate
— Methodtriangulate(cmd0::String="", arg1=nothing; kwargs...)
Reads randomly-spaced x,y,z and performs Delaunay triangulation, i.e., it finds how the points should be connected to give the most equilateral triangulation possible.
See full GMT (not the GMT.jl
one) docs at triangulate
Parameters
A | area :: [Type => Bool]
Compute the area of the Cartesian triangles and append the areas in the output segment headers [no areas calculated]. Requires triangles and is not compatible with voronoi (GMT >= 6.4).
C | slope_grid :: [Type => Number]
Read a slope grid (in degrees) and compute the propagated uncertainty in the bathymetry using the CURVE algorithm
D | derivatives :: [Type => Str]
Take either the x- or y-derivatives of surface represented by the planar facets (only used when G is set).
E | empty :: [Type => Str | Number]
Set the value assigned to empty nodes when G is set [NaN].
G | save | outgrid | outfile :: [Type => Str]
Use triangulation to grid the data onto an even grid (specified with R I). Append the name of the output grid file.
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
L | index :: [Type => Bool]
Give name of file with previously computed Delaunay information. If the indexfile is binary and can be read the same way as the binary input table then you can append +b to spead up the reading (GMT6.4).
M | network :: [Type => Bool]
Output triangulation network as multiple line segments separated by a segment header record.
N | ids :: [Type => Bool]
Used in conjunction with G to also write the triplets of the ids of all the Delaunay vertices
Q | voronoi :: [Type => Str | []]
Output the edges of the Voronoi cells instead [Default is Delaunay triangle edges]
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
S | triangles :: [Type => Bool]
Output triangles as polygon segments separated by a segment header record. Requires Delaunay triangulation.
T | edges :: [Type => Bool]
Output edges or polygons even if gridding has been selected with the G option
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
Z | xyz | triplets :: [Type => Bool]
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
bo | binary_out :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary output.
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? triangulate$
GMT.triplot
— Methodtriplot(in::Matrix; onlyedges::Bool=false, noplot::Bool=false, kw...)
Plots the 2-D triangulation or Voronoi polygons defined by the points in a matrix
in
: The input data. Can be either a Mx2 or Mx3 matrix.noplot
: Return the computed Delaunay or Veronoi data instead of plotting it (the default).onlyedges
: By default we compute Delaunay tringles or Veronoi cells as polygons. Use this option asonlyedges=true
to compute multiple line segments.region
: Sets the data region (xmin,xmax,ymin,ymax) forvoronoi
(required). If not provided we compute it fromin
.voronoi
: Compute Voronoi cells instead of Delaunay triangles (requiresregion
).kw...
: keyword arguments used in the $plot$ module (ignore ifnoplot=true
).
Returns
A GMTdataset if noplot=true
or $nothing$ otherwise.
Example:
triplot(rand(5,2), voronoi=true, show=true)
triplot(rand(5,3), lc=:red, show=true)
GMT.trisurf
— Methodtrisurf(in, kw...)
Plots the 3-D triangular surface defined by the points in a Mx3 matrix or a GMTdataset with data x, y, z in the 3 first columns. The triangles are computed with a Delaunay triangulation done internaly. Since this is a plot3d
avatar all options in this function are those of the plot3d
program.
Example
x,y,z = GMT.peaks(N=45, grid=false);
trisurf([x[:] y[:] z[:]], pen=0.5, show=true)
GMT.uniqueind
— Methodind = uniqueind(x)
Return the index ind
such that x[ind] gets the unique values of x. No sorting is done
GMT.upGMT
— FunctionupGMT(up=false)
Check if a new GMT (C binaries) version is available. If yes, use upGMT(true)
to update it.
GMT.vecangles
— Methodangles, ind = vecangles(lonlat0::VecOrMat{Real}, lonlat1::Matrix{Real}; proj::String="",
s_srs::String="", epsg::Integer=0, sorted=true)
Computes the angles between lines taken from the central point lonlat0
and those passed in the Mx2 matrix lonlat1
.
Args:
lonlat1
: - coordinates of point 1 in the given projection (or a matrix with several points).lonlat2
: - coordinates of point 2 in the given projection (or a matrix with same size aslonlat1
).proj
ors_srs
: - the given projection whose ellipsoid we move along. Can be a proj4 string or an WKT.epsg
: - Alternative way of specifying the projection [Default is WGS84].sorted
: - By default we sort the lines azimuth so that the angles refer to contiguous line. Ifsorted
is set tofalse
we compute the angles in the order of points as given inlonlat2
.
Returns
angles
- A Float64 vector with the angles between center and points determined by the arguments plus the angle betwen the lines from center to first and from center to last point.ind
- A vector of Int with the order obtained by sorting the lines azimuths (whensorted=true
). Apply it tolonlat2[ind,:]
to get the point distribution order in the same way asangles
. Neddless, ofc, ifsorted=false
.
GMT.velo
— Functionvelo(cmd0::String="", arg1=nothing; kwargs...)
Plot velocity vectors, crosses, and wedges.
See full GMT (not the GMT.jl
one) docs at velo
velo(mat2ds([0. -8 0 0 4 6 0.5; -8 5 3 3 0 0 0.5], ["4x6", "3x3"]), pen=(0.6,:red), fill_wedges=:green, outlines=true, Se="0.2/0.39/18", arrow="0.3c+p1p+e+gred", region=(-15,10,-10,10), show=1)
GMT.vlines
— Functionvlines(arg; decorated=(...), ymin=NaN, ymax=NaN, percent=false, kwargs...)
Plots one or a collection of vertical lines with eventual decorations
ymin
&ymax
: Limit the vertical lines to start aymin
and/or end atymax
percent
: If true thexmin
&xmax
are interpreted as fractions of the figure width.B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
W | pen | line_attrib :: [Type => Str]
Set pen attributes for the horizontal lines
Example:
plot(rand(5,3), region=[0,1,0,1])
vlines!([0.2, 0.6], pen=(1, :red), show=true)
GMT.weather
— Function[D =] weather(lon=0.0, lat=0.0; city::String="", last=0, days=7, year::Int=0, starttime::Union{DateTime, String}="",
endtime::Union{DateTime, String}="", variable="temperature_2m", debug=false, show=false, kw...)
Plots and/or retrieve weather data obtained from the Open-Meteo API. Please consult the site for further details. You will find that there are many variables available to plot and with not so obvious names. There are also forecast and archive versions of the variables. This function tries to guess that from the variable names. That list of variable names is a bit extensive and we are not reproducing it entirely here, but given it interest for climatological reason, we do list the so called $daily$ variables.
variable
: "temperature2mmax", "temperature2mmin", "apparenttemperaturemax", "apparenttemperaturemin", "precipitationsum", "rainsum", "snowfallsum", "precipitationhours", "sunshineduration", "daylightduration", "windspeed10mmax", "windgusts10mmax", "winddirection10mdominant", "shortwaveradiationsum", "et0fao_evapotranspiration"
A word of aknowledge is also due to the WeatherReport.jl project that inspired this function, that is much smaller (~25 LOC) and has no further dependencies than GMT itself.
lon
andlat
: Explicitly provide the coordinates of the location. If not provided, nor thecity
name, the current location is used from an IP location service (see thewhereami
function help).city
: The name of the location that will be used. City names are normally OK but if it fails see the help of thegeocoder()
function as that is what is used to transform names to coordinates. The default is to use the current geographic location of the user.days
: When asking for forecasts this is the number of days to forecast. Maximum is 16 days. Default is 7.starttime
: Limit to events on or after the specified start time. NOTE: All times use ISO8601 Date/Time format OR a DateTime type. Default is NOW - 30 days.endtime
: Limit to events on or before the specified end time. Same remarks as forstarttime
. Default is present time.last
: If value is an integer (e.g.last=90
), select the events in the last n days. If it is a string than we expect that it ends with a 'w'(eek), 'm'(onth) or 'y'(ear). Example:last="2Y"
(period code is caseless)year
: An integer, restrict data download to this year.debug
: Print the url of the requested data and return.data
: The default is to make a seismicity map but if thedata
option is used (containing whatever) we return the data in a $GMTdataset$figname
: savefig | figname | name :: [Type => Str]Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")show
: By default this function just returns the data in aGMTdataset
but ifshow=true
it shows the plot. Usedata=true
to also return the data even whenshow=true
.
Examples
# Plot the temperature forecast of your location. Also returns the data table.
D = weather(data=true, show=true)
# Plot the rain fall during 2023 at Copenhagen
weather(city="Copenhagen", year=2023, variable="rain_sum", show=true)
GMT.whereami
— MethodD = whereami() -> GMTdataset
Shows your current location plus some additional information (Timezone, Country, City, Zip, IP address).
GMT.wiggle
— Methodwiggle(cmd0::String="", arg1=nothing; kwargs...)
Reads (length,azimuth) pairs from file and plot a windwiggle diagram.
See full GMT (not the GMT.jl
one) docs at pswiggle
Parameters
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
Z | ampscale | amp_scale :: [Type => Number | Str]
Gives anomaly scale in data-units/distance-unit.
A | azimuth :: [Type => Str | number]
Sets the preferred positive azimuth. Positive wiggles will “gravitate” towards that direction.
B | frame | axis | xaxis yaxis:: [Type => Str]
Set map boundary frame and axes attributes.
C | center :: [Type => Number]
Subtract center from the data set before plotting [0].
D | scale_bar :: [Type => Str]
Defines the reference point on the map for the vertical scale bar using one of four coordinate systems.
F | box :: [Type => Str]
Without further options, draws a rectangular border around the vertical scale bar.
G | fill :: [Type => Number | Str]
Set fill shade, color or pattern for positive and/or negative wiggles [Default is no fill].
I | fixed_azim :: [Type => Number]
Set a fixed azimuth projection for wiggles [Default uses track azimuth, but see -A].
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
P | portrait :: [Type => Bool or []]
Tell GMT to NOT draw in portrait mode (that is, make a Landscape plot)
T | track :: [Type => Number or Str | Tuple | []]
Draw track [Default is no track]. Append pen attributes to use [Defaults: width = 0.25p, color = black, style = solid].
W | pen :: [Type => Number | Str | tuple | []]
Specify outline pen attributes [Default is no outline].
U | time_stamp | timestamp :: [Type => Str or Bool or []] $Arg = [[just]/dx/dy/][c|label]$
Draw GMT time stamp logo on plot.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
X | x_offset | xshift :: [Type => Str] $Arg = [a|c|f|r][x-shift[u]]$
Y | y_offset | yshift :: [Type => Str] $Arg = [a|c|f|r][y-shift[u]]$
Shift plot origin relative to the current origin by (x-shift,y-shift) and optionally append the length unit (c, i, or p).
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
p | view | perspective :: [Type => Str or List] $Arg = [x|y|z]azim[/elev[/zlevel]][+wlon0/lat0[/z0]][+vx0/y0]$
Selects perspective view and sets the azimuth and elevation of the viewpoint [180/90].
t | alpha | transparency :: [Type => Str] $Arg = transp$
Set PDF transparency level for an overlay, in (0-100] percent range. [Default is 0, i.e., opaque].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
savefig | figname | name :: [Type => Str]
Save the figure with the
figname=name.ext
whereext
chooses the figure format (e.g. figname="name.png")
To see the full documentation type: $@? pswiggle$
GMT.windbarbs
— Functionwindbarbs(arg1; kwargs...)
or
windbarbs(u, v; kwargs...)
Plot wind barbs in either 2D or 3D, from table data or two u,v grids.
polar | A
: (grids method)color | C
:offset | D
:fill | G
:intens | I
: (table method)spacing | I
: (grids method)noclip | N
:barbs | Q
:pen | W
:azimuths | Z
: (grids method)
Example
GMT.wkt2proj
— Methodwkt2proj(wkt_str::String)
Convert a WKT SRS string into the PROJ4 form.
GMT.wmsinfo
— Methodwmsinfo(server::String)
Read the xml information from the WebMapServer service and create a WMS data type that holds the information necessary to download the data. The show
method will display the contents of the WMS data type.
server
: The server URL address.
Example
wms = wmsinfo("http://tiles.maps.eox.at/wms?")
As an option, use the form
wmsinfo(wms; layer)
to get further information, in particular the number of bands and sizes, of the layer number or layer name layer
. wms
is returned by the first form.
GMT.wmsread
— Methodwmsread(wms::WMS; layer=?, kwargs...)
Read the layer
number provided by the service from which the wms
type was created.
Parameters
wms
: A WMS type obtained from thewmsinfo
function.layer
: The layer number or layer name of interest from those provided by the WMS service. That is, both of these forms are allowed:layer=3
orlayer="Invented layer name"
kwargs
is the keywords/values pairs used to set
region | limits
: The region limits. This can be a Tuple or Array with 4 elements defining the(xmin, xmax, ymin, ymax)
or a string defining the limits in all ways that GMT can recognize. When the layer has the data projected, we can a Tuple or Array with 3 elements(lon0, lat0, width)
, where first two set the center of a square in geographical coordinates and the third (width
) is the width of that box in meters.cellsize | pixelsize | resolution | res
: Sets the requested cell size in meters [default]. Use a string appended with a 'd' (e.g.resolution="0.001d"
) if the resolution is given in degrees. This way works only when the layer is in geogs.size
: Alternatively to the thecellsize
use this option, a tuple or array with two elements, to specify the image dimensions. Example,size=(1200, 100)
to get an image with 1200 rows and 100 columns.time
: Some services provide data along time. Use this option to provide a time string as provided by DateTime. For example:time=string(DateTime(2021,10,29))
geog | force_geog | forcegeog
: Force the requested layer to be in geographical coordinates. This is useful when the data is in projected coordinates (check that by asking the contents ofwms.layer[layer].srs
) but want to pass aregion
in geogs. Warning: there is no guarantee that this always works.
Returns
A GMTimage
Examples
wms = wmsinfo("http://tiles.maps.eox.at/wms?")
img = wmsread(wms, layer=3, region=(-10,-5,37,44), pixelsize=500);
# Retrieve and display a MODIS image
wms = wmsinfo("https://gibs-c.earthdata.nasa.gov/wms/epsg4326/best/wms.cgi");
img = wmsread(wms, layer="MODIS_Terra_CorrectedReflectance_TrueColor", region=(9,22,32,43), time="2021-10-29T00:00:00", pixelsize=750);
imshow(img, proj=:guess)
GMT.wmstest
— Methodwmstest(wms::WMS; layer, size::Bool=false, kwargs...)
Test function that generates the GetMap request string or the size of the resulting image given the requested resolution. It is meant to generate first the command that gets the image/grid but not running it. Specially usefull to check that the resulting image size is not huge.
Parameters
wms
: A WMS type obtained from thewmsinfo
function.layer
: The layer number or layer name of interest from those provided by the WMS service. That is, both of these forms are allowed:layer=3
orlayer="Invented layer name"
size
: Iffalse
, returns the GetMap request string, otherwise the image size given the requested resolution.
kwargs
is the keywords/values pairs used to set
region | limits
: The region limits. This can be a Tuple or Array with 4 elements defining the(xmin, xmax, ymin, ymax)
or a string defining the limits in all ways that GMT can recognize. When the layer has the data projected, we can a Tuple or Array with 3 elements(lon0, lat0, width)
, where first two set the center of a square in geographical coordinates and the third (width
) is the width of that box in meters.cellsize | pixelsize | resolution | res
: Sets the requested cell size in meters [default]. Use a string appended with a 'd' (e.g.resolution="0.001d"
) if the resolution is given in degrees. This way works only when the layer is in geogs.
Returns
Either a the GetMap request string (when size=false
) or the resulting image/grid size dim_x, dim_y
Example
wmstest(wms, layer=34, region=(-8,39, 100000), pixelsize=100)
"WMS:http://tiles.maps.eox.at/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&LAYERS=s2cloudless-2020_3857&SRS=EPSG:900913&BBOX=-940555.9,4671671.6,-840555.9,4771671.68&FORMAT=image/jpeg&TILESIZE=256&OVERVIEWCOUNT=18&MINRESOLUTION=0.59716428347794&TILED=true"
GMT.worldrectangular
— MethodGI[,coast] = worldrectangular(GI; proj::String="+proj=vandg", pm=0, latlim=:auto, coast=false)
Try to create a rectangular map out miscellaneous and not cylindrical projections.
GI
: A GMTgrid or GMTimage data type.GI
can also be a string with a file name of a grid or image.proj
: A PROJ4 string describing the projection.pm
: The projection prime meridian (Default is 0).latlim or latlims
: Latitude(s) at which the rectangular map is trimmed. The default (:auto) means that we will try to trim such that we get a fully filled grid/image. Uselatlim=(lat_s,lat_n)
orlatlim=lat
to make it equivalent tolatlim=(-lat,lat)
.coast
: Return also the coastlines projected withproj
. Passcoast=res
, whereres
is one of GMT coastline resolutions (e.g. :crude, :low, :intermediate).coast=true
is <==>coast=:crude
Passcoast=D
, whereD
is vector of GMTdataset containing coastline polygons with a provenience other than the GSHHG GMT database.
Returns
A grid or an image and optionally the coastlines ... or errors. Not many projections support the procedure implemented in this function. The working or not is controlled by PROJ's +over
option https://proj.org/usage/projections.html#longitude-wrapping
Example:
G = worldrectangular("@earthrelief10m_g") imshow(G)
GMT.worldrectcoast
— Methodcl = worldrectcoast(proj="?", res="crude", coastlines=nothing, limits=Float64[])
Return a project coastline, at res
resolution, suitable to overlain in a grid created with the worldrectangular
function. Note that this function, contrary to coastlinesproj
, returns coastline data that spans > 360 degrees.
proj
: A proj4 string describing the projection (Mandatory).res
: The GSHHG coastline resolution. Available options are:crude
,low
,intermediate
,high
andfull
coastlines
: In alternative to theres
option, one may pass a GMTdataset with coastlines previously loaded (withgmtread
) from another source.limits
: If not empty it must be a 2 elements array with lonmin, lonmax that is used to ask for coastlines that expand more than 360 degrees (worldrectangular
uses this).
Returns
A Vector of GMTdataset containing the projected world GSHHG coastlines at resolution res
.
GMT.worldrectgrid
— Methodgrat = worldrectgrid(GI; width=(30,20), grid=nothing, annot_x=nothing)
or
grat = worldrectgrid(; proj="projection", width=(30,20), grid=nothing, annot_x=nothing)
Create a grid of lines (graticules) in projected coordinates. The projection system is extracted from the GI
metadata.
GI
: A GMTgrid or GMTimage data type created with theworldrectangular
function.proj
: Pass a proj4 string or Symbol describing the projection. Alternatively pass a referenced GMTdataset from which the projection will be extracted.width
: A scalar or two elements array/tuple with increments in longitude and latitude. If scalar, widthx = widthy.grid
: Instead of using thewidth
argument, that generates an automatic set of graticules, one may pass a two elements Vector{Vector{Real}} with the meridians (grid[1]) and parallels (grid[2]) to create.annot_x
: By default, all meridians are annotated whengrat
is used in theplotgrid!
function, but depending on the projection and thelatlim
argument used inworldrectangular
we may have the longitude labels overlap close to the prime meridian. To minimize that pass a vector of longitudes to be annotated. e.g.annot_x=[-180,-150,0,150,180]
will annotate only those longitudes.
Returns
A Vector of GMTdataset containing the projected meridians and parallels. grat[i]
attributes store information about that element lon,lat.
GMT.wraplon180!
— Methodlon = wraplon180!(lon::Vector{<:Real})
Wrap longitudes to be in the range -180 to 180.
GMT.xy2lonlat
— Functionxy2lonlat(xy::Matrix{<:Real}, s_srs=""; s_srs="", t_srs="+proj=longlat +datum=WGS84")
or
xy2lonlat(D::GMTdataset, s_srs=""; s_srs="", t_srs="+proj=longlat +datum=WGS84")
Computes the inverse projection from XY to LonLat in the given projection. The output is assumed to be in WGS84. If that isn't right, pass the appropriate projection info via the t_srs
option (PROJ4, WKT, EPSG).
Parameters
xy
: The input data. It can be a Matrix, or a GMTdataset (or vector of it)s_srs
: The data projection system. This can be a PROJ4, a WKT string or EPSG codet_srs
: The target SRS. If the default is not satisfactory, provide a new projection info (PROJ4, WKT, EPSG)
Returns
A Matrix if input is a Matrix or a GMTdadaset if input had that type
GMT.xyz2grd
— Functionxyz2grd(cmd0::String="", arg1=nothing; kwargs...)
Convert data table to a grid file.
See full GMT (not the GMT.jl
one) docs at xyz2grd
Parameters
I | inc | increment | spacing :: [Type => Str] $Arg = xinc[unit][+e|n][/yinc[unit][+e|n]]]$
x_inc [and optionally y_inc] is the grid spacing. Optionally, append an increment unit.
R | region | limits :: [Type => Str or list or GMTgrid|image] $Arg = (xmin,xmax,ymin,ymax)$
Specify the region of interest. Set to data minimum BoundinBox if not provided.
A | multiple_nodes :: [Type => Str]
Arg = [d|f|l|m|n|r|S|s|u|z]
By default we will calculate mean values if multiple entries fall on the same node. Use A to change this behavior.
D | header :: [Type => Str]
Arg = [+xxname][+yyname][+zzname][+sscale][+ooffset][+ninvalid][+ttitle][+rremark]
Output edges
G | save | outgrid | outfile :: [Type => Str]
Output grid file name. Note that this is optional and to be used only when saving the result directly on disk. Otherwise, just use the G = grdclip(....) form.
J | proj | projection :: [Type => String]
Select map projection. Defaults to 15x10 cm with linear (non-projected) maps.
S | swap :: [Type => Str | []]
Arg = [zfile]
Swap the byte-order of the input only. No grid file is produced.
V | verbose :: [Type => Bool or Str] $Arg = [level]$
Select verbosity level, which will send progress reports to stderr.
Z | flags :: [Type => Str]
Read a 1-column table. This assumes that all the nodes are present and sorted according to specified ordering convention contained in. $flags$.
bi | binary_in :: [Type => Str] $Arg = [ncols][type][w][+L|+B]$
Select native binary format for primary input (secondary inputs are always ASCII).
di | nodata_in :: [Type => Str or Number] $Arg = nodata$
Examine all input columns and if any item equals nodata we interpret this value as a missing data item and substitute the value NaN.
e | pattern | find :: [Type => Str] $Arg = [~]”pattern” | -e[~]/regexp/[i]$
Only accept ASCII data records that contains the specified pattern.
f | geog | colinfo | coltypes | coltype :: [Type => Str] $Arg = [i|o]colinfo$
Specify the data types of input and/or output columns (time or geographical data).
h | header :: [Type => Str] $Arg = [i|o][n][+c][+d][+rremark][+ttitle]$
Primary input file(s) has header record(s).
i | incols | incol :: [Type => Str] $Arg = cols[+l][+sscale][+ooffset][,…]$
Select specific data columns for primary input, in arbitrary order.
r | reg | registration :: [Type => Bool or []]
Force pixel node registration [Default is gridline registration].
w | wrap | cyclic :: [Type => Str or Number] $Arg = [[-]n]$
Convert input records to a cyclical coordinate.
yx :: [Type => Str or Bool or []] $Arg = [i|o]$
Swap 1st and 2nd column on input and/or output.
To see the full documentation type: $@? xyz2grd$
GMT.xyzw2cube
— Methodxyzw2cube(fname::AbstractString; zcol::Int=4, datatype::DataType=Float32, proj4::String="", wkt::String="",
epsg::Int=0, tit::String="", names::Vector{String}=String[], varnames::Vector{String}=String[])
or
xyzw2cube(D::GMTdataset; zcol::Int=4, datatype::DataType=Float32, tit::String="",
names::Vector{String}=String[], varnames::Vector{String}=String[])
Convert data table containing a cube into a GMTgrid cube. The input data must contain a completelly filled 3D matrix and the data layout is guessed from file analysis (if it fails ... bad chance).
Parameters
fname
: The filename of the cube in text formatdatatype
: The data type where the data will be stored. The default is Float32.tit
: A title string to describe this cube.proj4
: A proj4 string for dataset SRS.wkt
: Projection given as a WKT SRS.epsg
: Same asproj
but using an EPSG codenames
: used to give a description for each layer (also saved to file when using a GDAL function).varnames
: A string vector with the names of the variables in the cube. By default we get those from the column names (when available). Example:varnames=["lon", "lat", "depth", "temp"]
.zcol
: The column number where the z values are stored. The default is 4. Use a higher number if the data set has more than 4 columns and you want to use one of those last columns as z values.
Returns
A GMTgrid cube object.
GMT.yeardecimal
— Methodyeardecimal(date)
Convert a Date or DateTime or a string representation of them to decimal years.
Example
yeardecimal(now())
GMT.zonal_statistics
— Methodzonal_statistics(GI::GItype, shapes::GDtype, fun::Function; touches=false, byfeatures=false, groupby="")
or
zonal_statistics(fun::Function, GI::GItype, shapes::GDtype; touches=false, byfeatures=false, groupby="")
or zonal_stats(...)
Compute the statistics of fun
applied to the elements of the grid or image GI
that lie inside the polygons of the GMTdataset shapes
.
Arguments
GI
: A grid (GMTgrid) or image (GMTimage) type uppon which the statistics will be computed by applying thefun
function to the elements that fall inside the polygons ofshapes
.shapes
: A vector of GMTdataset containing the polygons inside which the elements ifGI
will be assigned a single value obtained by applying the functionfun
.fun
: A unidemensional function name used to compute the contant value for theGI
elements that fall inside each of the polygons ofshapes
.
Parameters
touches
: include all cells/pixels that are touched by the polygons. The default is to include only the cells whose centers that are inside the polygons.byfeatures
: Datasets read from OGR vector filres (shapes, geopackages, arrow, etc) are organized in features that may contain several geomeometries each. Each group of geometries in a Feature share the sameFeauture_ID
atribute. Ifbyfeatures
is true, the functionfun
will be applied to each feature independently. This option is actually similar to thegroupby
parameter but doesn't require an attribute name. If neither ofbyfeatures
orgroupby
are provided, thefun
function is applied to each of the polygons independently.groupby
: If provided, it must be an attribute name, for example,groupby="NAME"
. If not provided, we use theFeature_ID
attribute that is a unique identifier assigned during an OGR file reading (by the GMT6.5 C lib). If neither ofbyfeatures
orgroupby
are provided, thefun
function is applied to each of the polygons independently.
Examples
What is the mean altitude of Swisserland?
G = gmtread("@earth_relief_06m");
Swiss = coast(DCW=:CH, dump=true, minpts=50);
zonal_statistics(G, Swiss, mean)
1×1 GMTdataset{Float64, 2}
Row │ X
─────┼─────────
1 │ 1313.21
GMT.zscale
— Functionzscale(input::AbstractArray,
nsamples=1000;
contrast=0.25,
max_reject=0.5,
min_npixels=5,
k_rej=2.5,
max_iterations=5)
Implementation of the zscale
IRAF function for finding colorbar limits of input
, which showcase data near the median. This is useful for data with extreme outliers, such as astronomical images.
Keyword arguments
nsamples
- The number of samples to use frominput
. If fewer thannsamples
are present, will use the full inputcontrast
- The desired contrastk_rej
- The number of standard deviations above which data is rejectedmax_iteration
- The number of iterations used for fitting samplesmax_reject
- The maximum number of pixels to reject during the iterative fittingmin_npixels
- The minimum number of pixels to calculate the limits after the iterative fitting
See the extended help (in REPL, ??zscale
) for technical details.
Examples
julia> img = 0:9999
julia> zscale(img)
(0, 9990)
Description
The zscale algorithm is designed to display the image values near the median image value, without the time consuming process of computing a full image histogram.
This is particularly useful for astronomical images, which generally have a very peaked histogram corresponding to the background sky in direct imaging, or the continuum in a two dimensional spectrum.
A subset of the image is examined, and approximately nsamples
pixels are sampled evenly over the image. The number of lines is a user parameter, nsample_lines
.
The pixels are ranked in brightness to form the function I(i)
, where i
is the rank of the pixel, and I
is its value. Generally, the midpoint of this function (the median) is very near the peak of the image histogram. There is a well defined slope about the midpoint, which is related to the width of the histogram.
At the ends of the I(i)
function, there are a few very bright and dark pixels due to objects and defects in the field. To determine the slope, a linear function is fit with iterative rejection:
I(i) = intercept + slope * (i - midpoint)
If more than half of the points are rejected, then there is no well defined slope, and the full range of the sample defines z1
and z2
. Otherwise, the endpoints of the linear function are used (provided they are within the original range of the sample):
z1 = I(midpoint) + (slope / contrast) * (1 - midpoint)
z2 = I(midpoint) + (slope / contrast) * (npoints - midpoint)
Credits
https://github.com/JuliaPlots/PlotUtils.jl