Skip to content
/ matSNIP Public

Short, simple, .m functions that I am using across repos and projects.

License

Notifications You must be signed in to change notification settings

apasto/matSNIP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

matSNIP

Project Status: Inactive – The project has reached a stable, usable state but is no longer being actively developed; support/maintenance will be provided as time allows.

⚠️ The functions that I am providing here have been both an exercise and a useful tool, for me. However, most of the map-related functionalities are better implemented in GMT modules and conveniently wrapped in the GMTMex GMT API for MATLAB. Use those, do not bother with these! Among other considerations, I am not mantaining this repository. Also, I will likely move some of the functions (such as RoundToStep and TileCheckerboard) to a separate repository. ⚠️

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.

Prerequisites

Dependencies were listed by calling matlab.codetools.requiredFilesAndProducts on the function files, in MATLAB 2018b.

  • Toolboxes: FwdRepro and InvRepro use mfwtran and minvtran, 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.

Installing

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()

List of scripts/functions

  • 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

Authors

Acknowledgements

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.

License

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.

About

Short, simple, .m functions that I am using across repos and projects.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published