Skip to main content

Advertisement

Log in

PySizer: resizing raster in eigenspace using Python

  • Software Article
  • Published:
Earth Science Informatics Aims and scope Submit manuscript

Abstract

A common practice in spatial analysis, data fusing, and geophysical interpretation is the need to handle raster datasets of different spatial resolution. Often, raster data are resampled through interpolation for better spatial representation and feature identification at both local and regional scales, but interpolation can result in artifact such as fewer blocks or mosaics, boundary blurring, edge halos, rings, and signal aliasing. In this study, we present the PySizer program developed using the Python programming language for data interpolation, with advanced performance. First, it has high interpolation accuracy by using the inverse spatial principal analysis (isPCA) in the eigenspace. Secondly, it has high calculation performance by using functions inside scientific Python modules, such as matrix operations of the NumPy. Thirdly, it supports most of currently available raster data formats and can manage spatial references information. PySizer is applicable to many fields, such as geophysical or other scientific data processing, remote sensing, (internet) video stream interpolation, and high quality image printing, to name a few. The tool was tested in this study using a potential-field data and bathymetric data, and the results were evaluated through visual inspection and statistical analysis, demonstrating high performance in accuracy and efficiency in resizing raster datasets. The PySizer source codes are freely available from public website or by contacting the authors for the latest version.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9
Fig. 10
Fig. 11
Fig. 12
Fig. 13
Fig. 14

Similar content being viewed by others

Availability and Requirements

We develop the PySizer as an open source program following the GNU GENERAL PUBLIC LICENSE (GPL 2.0) and it can be freely downloaded in the public domain at https://github.com/QingmouLi/PySizer. Readers can also contact the communicating author to get the latest version.

We developed the PySizer using pure Python (CPython) so that it could run on any Python (2.7+) supported OS platforms, such as the MS Windows 7&10, Linux or Mac OS. However, we only test it on 64-bit MS Windows 7&10 and Ubuntu 18.02. We also widely use the NumPy (11.0.0), SciPy (0.13.3), and GDAL (2.0.2) in an Anaconda (version 5.3, Anaconda Inc 2019) virtual environment.

References

  • Anaconda Inc (2019) Anaconda, https://www.anaconda.com/ (accessed in June-2019)

  • Balkwill HR, McMillan NJ (1990) Mesozoic-Cenozoic geology of the Labrador shelf. In: Keen MJ, Williams GL (eds) Geology of Canada, vol. 2, geology of the continental margin of eastern Canada. Geological Survey of Canada, Ottawa, pp 31–85

    Google Scholar 

  • Bardan V (1987) Trace interpolation in seismic data processing. Geophys Prospect 35:343–358

    Article  Google Scholar 

  • Briggs IC (1974) Machine contouring using minimum curvature. Geophysics 39:39–48

    Article  Google Scholar 

  • Eckstein AB (1989) Evaluation of spline and weighted average interpolation algorithms. Comput Geosci 15(1):79–94

    Article  Google Scholar 

  • Francisco JB (2013) Learning SciPy for numerical and scientific computing. Packt Publishing, Birmingham 150p

    Google Scholar 

  • Garrard C (2016) Geoprocessing with Python, Manning Publication Inc., Shelter Island 11964. 362 p

  • Golub GH, Kahan W (1965) Calculating the singular values and pseudo-inverse of a matrix. SIAM J Appl Math 2:205–224. https://doi.org/10.1137/0702016

    Article  Google Scholar 

  • Henry H (2019) Image©, perfect resize user manual, files.ononesoftware.com/site/user-guides/Resize9.pdf (accessed on 21-June, 2019)

  • Jolliffe, I.T., 2002. Principal component analysis (second edition), Springer-Verlag, New York. 414p

  • Krieger L, Peacock RJ (2014) Mtpy: a Python toolbox for magnetotellurics. Comput Geosci 72:167–175

    Article  Google Scholar 

  • Lambson B (2019) Image Resizer for Windows, V. 3.1.2, http://www.bricelam.net/ImageResizer, (accessed on 21-June, 2019)

  • Langtangen PH (2009) A primer on scientific programming with Python. Springer-Verlag, Berlin Heidelberg, p 693

    Book  Google Scholar 

  • Lawhead J (2013) Learning geospatial analysis with Python, Packt Publishing, Birmingham., 364p

  • Li, Q. and Dehler, S.,A., 2015. Inverse spatial principal component analysis for geophysical data interpolation. Journal of Applied Geophysics, 115, p. 79–91

    Article  Google Scholar 

  • Maeland E (1988) On the comparison of interpolation methods. IEEE Trans Med Imaging 7:213–217

    Article  Google Scholar 

  • Matheron G (1963) Principles of Geostatistics. Econ Geol 58:1246–1266

    Article  Google Scholar 

  • McKinney W (2013) Python for Data Analysis, Oreilly, Oreilly Media Inc., 1005, Gravenstein Highway North, CA 95472, 470 p

  • Oakey GN, Chalmers JA (2012) A new model for the Paleogene motion of Greenland relative to North America: plate reconstruction of the Davis Strait and Nares Strait regions between Canada and Greenland. J Geophys Res 117(B10401):1–28

    Google Scholar 

  • Oakey GN, Dehler SA (1998) Magnetic anomaly map, Atlantic Region, Canada, Geological Survey of Canada Open File 3659, scale 1:3000000

  • PyGMI (2019) Geological survey of South Africa, at http://patrick-cole.github.io/pygmi/index.html. (accessed on 21 June, 2019)

  • Qimage Ultimate (2019) http://www.ddisoftware.com/qimage-u/index.html (accessed on 21-June, 2019)

  • Saenz J, Zubillaga J, Fernandez J (2002) Geophysical data analysis using Python. Comput Geosci 28:457–465

    Article  Google Scholar 

  • Sandwell TD, Müller RD, Smith HFW, Garcia E, Francis R (2014) Global marine gravity model from CryoSat-2 and Jason-1 reveals buried tectonic structure. Science 346:65–67

    Article  Google Scholar 

  • Smith W K (2015) Cython-a guide for python programmers, O’Reilly publishing media, 1005 Gravenstein highway North, Sebastopol, CA 95472, 253 p

  • Smith MR, Nichols ST (1988) Efficient algorithms for generating interpolated (zoomed) MR images. Magn Reson Med 7:156–171

    Article  Google Scholar 

  • Srivastava SP (1978) Evolution of the Labrador Sea and its bearing on the early evolution of the North Atlantic. Geophys J R Astron Soc 52(2):313–357. https://doi.org/10.1111/j.1365-246X.1978.tb04235.x

    Article  Google Scholar 

  • Storey M, Duncan RA, Tegner C (2007) Timing and duration of volcanism in the North Atlantic Igneous Province: implications for geodynamics and links to the Iceland hotspot. Chem Geol 241(3–4):264–281. https://doi.org/10.1016/j.chemgeo.2007.01.016

    Article  Google Scholar 

  • Stytz MR, Parrot RW (1993) Using kriging for 3D medical imaging. Comput Med Imaging Graph 17:421–442

    Article  Google Scholar 

  • Titus J, Geroge S (2013) A comparison study on different interpolation methods based on satellite images. Int J Eng Res & Tech (IJERT) 2(6):82–85

  • Tosi, S., 2009. Matplotlib for Python developers. Packt Publishing, Birmingham., 307p

  • Trishchenko, A.P., Luo, Y., Khlopenkov, K., Park, W., and Wang, S. 2009. Arctic circumpolar mosaic at 250m spatial resolution for IPY by fusion of MODIS/TERRA land bands B1–B7. International Journal of Remote Sensing, 30, p. 1635–1641

    Article  Google Scholar 

  • Uieda L, Oliveira CV, Barbosa CV (2013) Modeling the Earth with Fatiando a Terra, PROC Of the 12th Python in Science Conf., p. 1–7

  • Wang Q, Shi W, Atkinson MP (2014) Sub-pixel mapping of remote sensing images based on radial basis interpolation

    Book  Google Scholar 

Download references

Acknowledgements

Authors give thanks to Chief Editor Babaie and the anonymous reviewers for the support and suggestion of the manuscript. The authors specifically thank one of the reviewers for the significant update of the manuscript. The authors wish to acknowledge support from Natural Resources Canada through the Geo-Mapping for Energy and Minerals 2 (GEM2) program and Geological Survey of Canada (GSC) Innovation Micro-fund of Geoscience for Climate Change Program. This is the Natural Resources of Canada’s research contribution number: 20180431.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Qingmou Li.

Additional information

Software files

A module file PySizer.py includes a class for handling the input/output, geo-transformation, spatial references, and non-value cell management for a GIS raster dataset. It also includes functions to calculate the singular spectrum (SSA), eigen-vectors, and loading of a raster, and to resize a raster using the isPCA method.

The SizeRaster.py is a demonstrating as well as a practical working program to do real raster resizing by calling the PySizer.py module. We honor POSIX command style for command arguments parsing and displaying help information, such as the input ‘-h’ will prompt the arguments format.

The readme.md gives more details and a data processing example.

We also include three additional sample data files, the Freeair gravity and magnetic anomalies, and bathymetry raster dataset files of the study area in the geotif (*.tif) file format, to levitate users’ starting curve

Publisher’s note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Highlights

• PySizer program is developed for resizing spatial raster data

• PySizer has high calculation performance comparable with native codes using scientific scripting;

• PySizer can accept major raster formats and handle georeference and geotransformation information;

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Li, Q., Dehler, S.A. PySizer: resizing raster in eigenspace using Python. Earth Sci Inform 13, 191–204 (2020). https://doi.org/10.1007/s12145-019-00406-y

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s12145-019-00406-y

Keywords

Navigation