poets.grid package¶
Submodules¶
poets.grid.grids module¶
- class poets.grid.grids.RegularGrid(sp_res, **kwargs)[source]¶
Bases: pytesmo.grid.grids.BasicGrid
Regular grid with coordinates as pixel center.
Regular grid that just has lat, lon coordinates and can find the nearest neighbour. It can also yield the gpi, lat, lon information in order.
- lon : numpy.array
- longitudes of the points in the grid
- lat : numpy.array
- latitudes of the points in the grid
- gpis : numpy.array, optional
- if the gpi numbers are in a different order than the lon and lat arrays an array containing the gpi numbers can be given if no array is given here the lon lat arrays are given gpi numbers starting at 0
- subset : numpy.array, optional
- if the active part of the array is only a subset of all the points then the subset array which is a index into lon and lat can be given here
- setup_kdTree : boolean, optional
- if set (default) then the kdTree for nearest neighbour search will be built on initialization
- shape : tuple, optional
- if given the grid can be reshaped into the given shape this indicates that it is a regular grid and fills the attributes self.londim and self.latdim which define the grid only be the meridian coordinates(self.londim) and the coordinates of the circles of latitude(self.latdim). The shape has to be given as (latdim, londim) It it is not given the shape is set to the length of the input lon and lat arrays.
- sp_res : int or float
- Spatial resolution of the grid.
- 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
- class poets.grid.grids.ShapeGrid(region, sp_res, shapefile=None)[source]¶
Bases: pytesmo.grid.grids.BasicGrid
Regular grid for a specific shape.
Regular grid for spedific shape, that just has lat,lon coordinates and can find the nearest neighbour. It can also yield the gpi, lat, lon information in order.
- lon : numpy.array
- longitudes of the points in the grid
- lat : numpy.array
- latitudes of the points in the grid
- gpis : numpy.array, optional
- if the gpi numbers are in a different order than the lon and lat arrays an array containing the gpi numbers can be given if no array is given here the lon lat arrays are given gpi numbers starting at 0
- subset : numpy.array, optional
- if the active part of the array is only a subset of all the points then the subset array which is a index into lon and lat can be given here
- setup_kdTree : boolean, optional
- if set (default) then the kdTree for nearest neighbour search will be built on initialization
- shape : tuple, optional
- if given the grid can be reshaped into the given shape this indicates that it is a regular grid and fills the attributes self.londim and self.latdim which define the grid only be the meridian coordinates(self.londim) and the coordinates of the circles of latitude(self.latdim). The shape has to be given as (latdim, londim) It it is not given the shape is set to the length of the input lon and lat arrays.
- region : str, optional
- Identifier of the region in the shapefile. If the default shapefile is used, this would be the FIPS country code.
- sp_res : float
- Spatial resolution of the grid.
- shapefile : str, optional
- Path to shape file, uses “world country admin boundary shapefile” by default.
- 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
- region : str
- Identifier of the region in the shapefile. If the default shapefile is used, this would be the FIPS country code.
- sp_res : float
- spatial resolution of the grid
- shp : poets.shape.shapes.Country
- Information about the country/region shape