geoist.raster package

Submodules

geoist.raster.dataset module

Name : dataset.py Created on : 2018/09/11 17:00 Author : Steve Chen<chenshi@cea-igp.ac.cn> Affiliation : Institute of Geophysics, CEA. Version : 0.1.0 License : Distributed under the MIT License. See LICENSE.txt for more info. Github : https://igp-gravity.github.io/ Description : This file is part of GEOIST, which is free software for geophysicist

who need to process and analysis data and study inversion problem and distributed in the hope that it will be useful. Anyone can download and know news from above Github website address.

Copyright (C) 2018-2020 GEOIST Development Team. All Rights Reserved.

class geoist.raster.dataset.DataSet

Bases: object

getBounds()

Return the lon/lat range of the data.

Returns:Tuple of (lonmin,lonmax,latmin,latmax)
getData(getCopy=False)

Return a reference to or copy of the data inside the Grid

Parameters:getCopy – True indicates that the user wants a copy of the data, not a reference to it.
Returns:A reference to or copy of a numpy array of data.
getValue(lat, lon, method='nearest', default=None)

Return numpy array at given latitude and longitude (using given resampling method).

Parameters:
  • lat – Latitude (in decimal degrees) of desired data value.
  • lon – Longitude (in decimal degrees) of desired data value.
  • method – Interpolation method, one of (‘nearest’,’linear’,’cubic’,’quintic’)
  • default – Default value to return when lat/lon is outside of grid bounds.
Returns:

Value at input latitude,longitude position.

interpolateToGrid(geodict, method='linear')

Given a geodict specifying a grid extent and resolution, resample current data set to match.

Parameters:
  • geodict – geodict object from a grid whose extents are inside the extent of this grid.
  • method – Optional interpolation method - [‘linear’, ‘cubic’,’quintic’,’nearest’]
Returns:

Interpolated grid.

Raises:
  • DataSetException – If the Grid object upon which this function is being called is not completely contained by the grid to which this Grid is being resampled.
  • DataSetException – If the resulting interpolated grid shape does not match input geodict.

This function modifies the internal griddata and geodict object variables.

load(bounds=None, resample=False, padValue=None)

Load data into a Grid subclass. Parameters below are suggested for subclasses.

Parameters:
  • filename – File where data is stored
  • bounds – Optional tuple of (lonmin,lonmax,latmin,latmax) used to subset data from file.
  • resample – If subsetting data, True indicates that exact bounds are desired and data should be resampled to fit.
  • padValue – If asking for data outside bounds of grid, any value not None means fill in those cells with padValue. None means don’t pad the grid at all.
Raises:

NotImplementedError – Always for this base class.

save(filename)

Save the data contained in the grid to a format specific file. Other attributes may be required for format specific files.

Parameters:filename – Where file containing data should be written.
setData(data)

Modify the data inside the Grid.

Parameters:data – numpy array of desired data.
trim(geodict, resample=False, method='linear')

Trim data to a smaller set of bounds, resampling if requested. If not resampling, data will be trimmed to smallest grid boundary possible.

Parameters:
  • geodict – GeoDict object used to specify subset bounds and resolution (if resample is selected)
  • resample – Boolean indicating whether the data should be resampled to exactly match input bounds.
  • method – If resampling, method used, one of (‘linear’,’nearest’,’cubic’,’quintic’)
exception geoist.raster.dataset.DataSetException(value)

Bases: Exception

Class to represent errors in the DataSet class.

exception geoist.raster.dataset.DataSetWarning(value)

Bases: Warning

Class to represent warnings in the DataSet class.

geoist.raster.gdal module

geoist.raster.geodict module

geoist.raster.gmt module

geoist.raster.grid2d module

geoist.raster.gridbase module

geoist.raster.gridcontainer module

geoist.raster.reader module

Module contents