NSInterpolate
Documentation for NSInterpolate.
After Naprstek and Smith, 2019.
NSInterpolate.NSInterpolateNSInterpolate.NSinterpNSInterpolate.NSinterpNSInterpolate.NSinterpNSInterpolate.NSinterpNSInterpolate.cell_to_dimNSInterpolate.get_located_dataNSInterpolate.initial_averageNSInterpolate.initial_interpolationNSInterpolate.obs_from_geowhizzNSInterpolate.obs_from_geoxyzNSInterpolate.xyz_channelsNSInterpolate.xyz_countNSInterpolate.xyz_lines
NSInterpolate.NSInterpolate — Module
NSInterpolate interpolates data irregularly sampled in 2 dimensions onto a regular grid. It is designed originally for aeromagnetic data but is also very effective for airborne gravity and airborne gravity gradient data. These data are all sampled along flight-lines that are close to being straight lines and it is likely that the method will work well for any data sampled in this way.
The code is a conversion from c#, published by T. Naprstek and R. S. Smith (2019, A new method for interpolating linear features in aeromagnetic data. Geophysics, 84(3), JM15-JM24).
I have used version NSI_v8 from github: https://github.com/TomasNaprstek/Naprstek-Smith-Interpolation.
Mark Dransfield 2024
NSInterpolate.NSinterp — Method
NSinterp(paramd::Dict; verbose=false)Use control parameters to perform gridding of observed survey data and manage resultant grid.
Arguments
paramd: A dictionary containing the input parameters (see Notes).verbose: A flag to indicate verbose reporting of progress or not (default).
NSInterpolate.NSinterp — Method
NSinterp(obs::DimStack, paramd::Dict; verbose=false)Use control parameters to perform gridding of observed survey data and manage resultant grid.
Arguments
obs: A DimStack of geographically located observed data.paramd: A dictionary containing the input parameters (see Notes).verbose: A flag to indicate verbose reporting of progress or not (default).
NSInterpolate.NSinterp — Method
NSinterp(param_file::String; verbose=false)Use control parameters to perform gridding of observed survey data and manage resultant grid.
Arguments
param_file: The name of the JSON file containing the input parameters.verbose: A flag to indicate verbose reporting of progress or not (default).
NSInterpolate.NSinterp — Method
NSinterp(;input_file::String, east::String, north::String, z::String,
z_units::String, en_units::String, diff_z::Bool, datum::String, projection::String,
outputwritebool::Bool, outfile::String, cellSize::Float64, interpDist::Float64,
maxLoop::Int64, searchStepSize::Float64, cellSizeF::Float64, trendM::Float64,
autoStop::Bool, angleSearch::Float64, multiSmooth::Float64, spatialSmooth::Bool,
realGridLocations::Bool, verbose=false
)Use control parameters to perform gridding of observed survey data and manage resultant grid.
Arguments
- various (see Notes).
verbose: A flag to indicate verbose reporting of progress or not (default).
Notes
The parameter file contains values for the following input parameters:
input_file: String
path of data file containing the observed data, either Geosoft XYZ or NetCDF4 nc format
input_east: String
the name of the channel in
input_filecontaining thexvalues, usually eastings.input_north: String
the name of the channel in
input_filecontaining theyvalues, usually northings.input_value: String
the name of the channel in
input_filecontaining the values to grid.z_units: String ("")
the units of the
input_valuedata; not used, simply written to output.en_units: String ("")
the units of the
input_eastandinput_northdata for writing to output.diff_z: Bool (false)
if true, then the
input_valuedata are differenced along flight-line before gridding.datum: String ("unknown")
the geographic datum (e.g. WGS84) for the input data; not used, simply written to output grid.
projection: String ("unknown")
the geographic projection for the input data (e.g. "NUTM17"); not used, simply written to output grid.
outputwritebool: Boolean (true)
if
false, no output file is written; iftrue, writes the output grid tooutputFile.outputFile: String
the name of the netCDF4 file to which the grid will be written.
cellSize: Float
edge size of each square cell in metres. This is the size of the grid cells during the interpolation. N&S generally recommend that the interpolation size be 0.5 x
cellSizeF, as this can help smooth out the data. However, this can also lead to weak lineaments not trending all the way between two flight lines, as they now have "further" to trend. N&S recommend experimentation, but in general this value should be half the size, or at most, the same as the output cell size.interpDist: Float
metres away that will be interpolated. Essentially, this determines how "far" the method will search for real data when completing the normalisation step. In general N&S recommend setting this to 75-100% of the flight line spacing. However, if a trend is at a highly acute angle to the flight lines, then it would require a much larger interpolation distance.
maxLoop: Integer (20)
the number of times the interpolation loop will be processed or maximum number of iterations. The maximum number of iterations that you wish the interpolation method to go through. This will depend highly on the dataset, but in general somewhere between 50 and 100 is enough, particularly when the automatic stopping criteria is used.
searchStepSize: Float
how much of a cell we will "travel" each search step
cellSizeF: Float
resampled final cell size. This is the size of the grid cells at the end of the interpolation. This should follow standard interpolation rules, for example for aeromagnetic data set to one-quarter to one-fifth the flight line spacing.
trendM: Float (0.0)
trend factor. Ranges between 0 and 100, affecting how strongly a lineament will be trended (100 is maximum, 0 is minimal trending). In general N&S recommend using 100. Irrelevant because a bug is preventing trending from working.
autoStop: Boolean (true)
whether or not to auto stop. Set to
trueif you wish to let the method determine when there is little change occurring between iterations. If set tofalseit will run formaxLoopiterations, as determined above.angleSearch: Float (10.0)
the number of degrees it will move each time when searching away from the initial eigenvector. When searching for flight line data in the normalization process, it is possible that the interpolation distance (described above) will be reached before a flight line data cell is found. If this occurs, then the search angle (as determined by the trend direction step) will be varied by this "trend angle" amount. In general N&S recommend 5-10 degrees. A lower value will be more accurate, however may dramatically increase the computation time. A higher value will lower the trending accuracy, but be computational quicker.
multiSmooth: Float (0.0)
percent amount of smoothing of the multiplier grid before applying the normalization process. Ranges between 0(no smoothing) and 100 (maximum smoothing), affecting the uniqueness of the normalization values . In general N&S recommend setting it to 0, and to only increase if high-frequency "noise" is appearing in the interpolation. The subsampling process of the interpolation cell size and output cell size will in general be more effective at reducing any high-frequency "noise", however in certain cases a high smoothing value (>75) will also help.
spatialSmooth: Boolean (true)
whether or not to use spatial smoothing (should usually be
true). This option should almost always be settrue, as it controls the first step of the iterative interpolation process. If turned off, the local derivatives are removed from the first step, effectively reducing it to a more simplistic smoothing operator. However, it is left as a variable to the user for two specific cases. First, it should always be turned off if using latitude/longitude coordinates rather than Northings/Eastings, or in any other case where the cell size is set to be less than 1. Second, it can be turned off as an additional control to reduce the linear structure within the data. In most datasets there will be very little difference between having the option on or off, however, if left off, some of the areas with minimal linear structure should result in even less linear structure.realGridLocations: Boolean (true)
if
false, outputs real data in the equi-distance grid cell locations. Iftrue, then output the real data cells as an average position of all real data within the cell. probably has no effect!!!
NSInterpolate.cell_to_dim — Method
NSInterpolate.get_located_data — Method
get_located_data(whizz_file::String, line, z_chan; north_chan="", east_chan"")Returns located data for a given survey line.
NSInterpolate.initial_average — Method
Check through all grid cells, and if a cell has more than one reading in it: average the value over the number of readings. Also average the relative positions and restore the offset, so that the mean value is at the mean position and not at the centre, or a corner of, the cell. The flag for the cell is then set to 1.
NSInterpolate.initial_interpolation — Method
Now go through all cells, and assign values to the ones that have no data currently, or determine if they are too far away from real data to use. During this process we will also find all closest data to each cell which will be information needed when normalizing.
The meaning of the cell flag is changed and now becomes: +1: a cell that has observations within its borders; 0: a cell without observations within its borders and whose value has been interpolated; -1: a cell too far from data to be interpolated and which will remain un-filled.
NSInterpolate.obs_from_geowhizz — Method
obs_from_geowhizz(whizz_file)
Read a set of observations and locations from a geoWhizz file.NSInterpolate.obs_from_geoxyz — Method
obs_from_geoxyz(xyz_file)
Read a set of XYZ observation locations from a Geosoft XYZ file.NSInterpolate.xyz_channels — Method
xyz_channels(file_name::String, num_head_recs::Integer, num_channels::Integer)Get the names of the channels in a Geosoft XYZ file_name. The algorithm checks num_head_recs header records. If it finds one with a number of words equal to the number of channels, num_channels, then it returns those words as an array of channel names.
NSInterpolate.xyz_count — Function
xyz_count(file_name::String)
Count the number of header records, flight lines and channels in XYZ file.
Also the decimal precision of each channel in the Geosoft XYZ file.
params
----------
file_name ::String
The name of the Geosoft XYZ file.
Returns
-------
num_head_recs ::Int
The .
num_lines ::Int
The .
num_channels ::Int
The .
field_precisions ::Int
The .NSInterpolate.xyz_lines — Method
xyz_lines(file_name::String, num_lines)
Returns the line numbers (`line_ids`), and the number of fiducials in each line.
A helper funtion for `xyz_to_whizz`.
params
----------
whizz_file ::String
The name of the geoWhizz file.
Returns
-------
None