Created on Aug 26, 2013
@author: Christoph Paulik Christoph.Paulik@geo.tuwien.ac.at
Bases: object
Grid that just has lat,lon coordinates and can find the nearest neighbour. It can also yield the gpi, lat, lon information in order.
Parameters: | lon : numpy.array
lat : numpy.array
gpis : numpy.array, optional
subset : numpy.array, optional
setup_kdTree : boolean, optional
shape : tuple, optional
|
---|
Attributes
arrlon | numpy.array | array of all longitudes of the grid |
arrlat | numpy.array | array of all latitudes of the grid |
n_gpi | int | number of gpis in the grid |
gpidirect | boolean | if true the gpi number is equal to the index of arrlon and arrlat |
gpis | numpy.array | gpi number for elements in arrlon and arrlat gpi[i] is located at arrlon[i],arrlat[i] |
subset | numpy.array | if given then this contains the indices of a subset of the grid. This can be used if only a part of a grid is interesting for a application. e.g. land points, or only a specific country |
allpoints | boolean | if False only a subset of the grid is active |
activearrlon | numpy.array | array of longitudes that are active, is defined by arrlon[subset] if a subset is given otherwise equal to arrlon |
activearrlat | numpy.array | array of latitudes that are active, is defined by arrlat[subset] if a subset is given otherwise equal to arrlat |
activegpis | numpy.array | array of gpis that are active, is defined by gpis[subset] if a subset is given otherwise equal to gpis |
issplit | boolean | if True then the array was split in n parts with the self.split function |
kdTree | object | grid.nearest_neighbor.findGeoNN object for nearest neighbor search |
shape | tuple, optional | if given during initialization then this is the shape the grid can be reshaped to this only makes sense for regular lat,lon grids |
latdim | numpy.array, optional | if shape is given this attribute has contains all latitudes that make up the regular lat,lon grid |
londim | numpy.array, optional | if shape is given this attribute has contains all longitudes that make up the regular lat,lon grid |
Methods
takes other BasicGrid or CellGrid objects and computes a lookup table between them. the lut will have the size of self.n_gpis and will for every grid point have the nearest index into other.arrlon etc.
Parameters: | other : grid object
max_dist : float, optional
into_subset : boolean, optional
|
---|
finds nearest gpi, builds kdTree if it does not yet exist
Parameters: | lon : float
lat : float
|
---|---|
Returns: | gpi : long
distance : float
|
Returns all active grid points
Parameters: | n : int, optional
|
---|---|
Returns: | gpis : numpy.array arrlon : numpy.array arrlat :numpy.array : |
Longitude and Latitude for given GPI.
Parameters: | gpi : int32
|
---|---|
Returns: | lon : float
lat : float |
Yields all grid points in order
Parameters: | n : int, optional
|
---|---|
Returns: | gpi : long
lon : float
lat : float
|
Bases: pytesmo.grid.grids.BasicGrid
Grid that has lat,lon coordinates as well as cell informatin. It can find nearest neighbour. It can also yield the gpi, lat, lon, cell information in cell order. This is important if the data on the grid is saved in cell files on disk as we can go through all grid points with optimized IO performance
Parameters: | lon : numpy.array
lat : numpy.array
cells : numpy.array
gpis : numpy.array, optional
subset : numpy.array, optional
|
---|
Attributes
arrcell | numpy.array | array of cell number with same shape as arrlon,arrlat |
activearrcell | numpy.array | array of longitudes that are active, is defined by arrlon[subset] if a subset is given otherwise equal to arrlon |
Methods
function to get all cell numbers of the grid
Returns: | cells : numpy.array
|
---|
Returns all active grid points
Parameters: | n : int, optional
|
---|---|
Returns: | gpis : numpy.array arrlon : numpy.array arrlat :numpy.array : cells : numpy.array |
Cell for given GPI.
Parameters: | gpi : int32
|
---|---|
Returns: | cell : int
|
Created on Jul 30, 2013
@author: Christoph Paulik christoph.paulik@geo.tuwien.ac.at
Bases: object
class that takes lat,lon coordinates, transformes them to cartesian (X,Y,Z) coordinates and provides a interface to scipy.spatial.kdTree as well as pykdtree if installed
Parameters: | lon : numpy.array or list
lat : numpy.array or list
R : float, optional
grid : boolean, optional
kd_tree_name : string, optional
|
---|
Attributes
R | float | earth radius to use in computation of x,y,z coordinates |
coords | numpy.array | 3D array of cartesian x,y,z coordinates |
kd_tree_name: string | name of kdTree implementation to use, either ‘pykdtree’ to use pykdtree or ‘scipy’ to use scipy.spatial.kdTree Fallback is always scipy if any other string is given or if pykdtree is not installed | |
kdtree: object | kdTree object that is built only once and saved in this attribute |
Methods
finds nearest index, builds kdTree if it does not yet exist
Parameters: | lon : float, list or numpy.array
lat : float, list or numpy.array
|
---|---|
Returns: | d : float, numpy.array
ind : int, numpy.array
index_lon : numpy.array, optional
index_lat : numpy.array, optional
|