matSNIP: short, simple, .m functions that I am using across repositories and projects (hence common). Most of the times these come from refactoring of larger scripts (hence snippets).
Since they reflect the original scope for which they were written for, they mostly manage data on rectangularly sampled geographical grids, stored in arrays as meshgrids or with accompanying grid-vectors. Whenever there is a reference to the term "map array", this is what is meant.
Nothing is particularly breathtaking, but they have already proved useful, and are generic enough that keeping them in a private repository would have been pointless.
Dependencies were listed by calling matlab.codetools.requiredFilesAndProducts
on the function files, in MATLAB 2018b.
-
Toolboxes: FwdRepro and InvRepro use
mfwtran
andminvtran
, which are provided in the MATLAB Mapping Toolbox. -
OCTAVE compatibility: ell2sph, sph2ell, FwdRepro, InvRepro perform calls to functions which have not been implemented yet (in version 1.2.1, as reported here). This list may not be exhaustive.
Add the repository folder (the one that this README is in) to your MATLAB® path. The contents of './+SNIP' will be then available as a 'package directory'.
SNIP.
must be prefixed to the called function.
Example:
SNIP.function_name()
- DispContents Print out contents of SNIP package.
- ell2sph Convert ellipsoidal to spherical coordinates, passing through ECEF
- FwdRepro Project array (rectangularly sampled) from WGS84 to UTM coordinates.
- gdf2array turn a gdf grid into an array with geographic reference
- getGRDnan get value at which NaNs are set in Surfer(R) grd format
- InvRepro Un-project array from UTM to WGS84 coordinates.
- mapimagesc wrap 'imagesc' to plot a 1:1 aspect, x,y-axis image
- mapLP lowpass Gaussian filter on image/map (as array)
- resampleDH resample grid to a grid complying to Driscoll and Healy (1994)
- RoundToStep round(/floor/ceil/fix) input vector to nearest arbitrary 'step' unit
- SmallCrop Given two maps, 'Big' and 'Small', crop 'Big' to the extent of 'Small'
- sph2ell Convert spherical to ellipsoidal coordinates, passing through ECEF
- TileCheckerboard creates a checkerboard with arbitrary sized square tiles
- Alberto Pastorutti - github.com/apasto
Re-formatting the contents list in UpdateCONTENTS with sed
was made possible by an answer to Replace newlines with literal \n by stackoverflow user anubhava.
The automatic call to UpdateCONTENTS was implemented thanks to this helpful tutorial: Update GH-pages automatically with Travis by RomanTsegelskyi.
TileCheckerboard uses this clever xor-based solution: MATLABtricks: Three ways to generate a checkerboard matrix (2013, Zoltan Fegyver). Archive.org link.
This project is licensed under the Apache-2.0 License - see the LICENSE file for details.
MATLAB® is a registered trademark of The MathWorks, Inc. Surfer® is a registered trademark of Golden Software, LLC.