This module provides functions for converting lonlat-information to pixels in an image file (eg. PNG, TIFF) and for calculating a country bounding box.
Clips bounding box out of image file and returns data as numpy.ndarray
Parameters: | source_file : str
region : str
shapefile : str, optional
|
---|---|
Returns: | data : dict of numpy.arrays
lon_new : numpy.array
lat_new : numpy.array
timestamp : datetime.date
metadata : dict of strings
|
Min and max longitude for countries that spread across the international dateline.
Returns: | lon_min, lon_max : float
|
---|
Converts a pair of lon and lat to its corresponding pixel value in an image file.
Parameters: | img : Image File, e.g. PNG, TIFF
lon : float
lat : float
|
---|---|
Returns: | Row : float
Col : float
|
Converts a pair of lon and lat to its corresponding pixel value in a rearranged image file (see rearrange_img).
Parameters: | img : Image File, e.g. PNG, TIFF
lon : float
lat : float
|
---|---|
Returns: | Row : float
Col : float
|
Converts two arrays of row and column pixels into their corresponding lon and lat arrays
Parameters: | img : Image file
lon_px : np.array
lat_px : np.array
|
---|---|
Returns: | lon_new : np.array
lat_new: np.array
|
Converts two arrays of row and column pixels into their corresponding lon and lat arrays
Parameters: | img : Image file
lon_px : np.array
lat_px : np.array
|
---|---|
Returns: | lon_new : np.array
lat_new: np.array
|
Rearranges image so that 0 degree Meridian is on the very left. Used when area around the +- 180 degree Meridian is of interest (eastern Russia, Alaska, New Zealand...).
Parameters: | img : Image File, e.g. PNG, TIFF
|
---|---|
Returns: | img : Image file
|
This module provides functions for loading from and writing to NetCDF4 files.
Clips bounding box out of netCDF file and returns data as numpy.ndarray
Parameters: | source_file : str
lon_min : float
lat_min : float
lon_max : float
lat_max : float
|
---|---|
Returns: | data : dict of numpy.arrays
lon_new : numpy.array
lat_new : numpy.array
timestamp : datetime.date
metadata : dict of strings
|
Gets variables, dimensions and time period from a netCDF file.
Parameters: | src_file : str
|
---|---|
Returns: | variables : list of str
dimensions : list of str
period : list of datetime.datetime
|
Gets images from a netCDF file.
Reads the image for a specific date. If date_to is given, it will return multiple images in a multidimensional numpy.ndarray
Parameters: | source_file : str
variable : str
date : datetime.datetime
date_to : datetime.date, optional
|
---|---|
Returns: | image : numpy.ndarray
lon : numpy.array
lat : numpy.array
metadata : dict of strings
|
Saves numpy.ndarray images as multidimensional netCDF4 file.
Creates a datetimeindex over the whole period defined in the settings file
Parameters: | image : dict of numpy.ndarrays
timestamp : datetime.datetime
region : str, optional
metadata : dict
dest_file : str
start_date : datetime.datetime
nan_value : int, optional
shapefile : str, optional
temp_res : string or int, optional
|
---|
Saves numpy.ndarray images as multidimensional netCDF4 file.
Parameters: | image : dict of numpy.ndarrays
timestamp : datetime.datetime
region : str, optional
metadata : dict
dest_file : str
nan_value : int, optional
shapefile : str, optional
|
---|
Averages image layers, given as ndimensional masked arrays to one image
Parameters: | image : numpy.ma.MaskedArray
|
---|---|
Returns: | avg_img : numpy.ma.MaskedArray
|
Resamples image to predefined gridpoints.
Parameters: | source_file : str
region : str
sp_res : int or float
shapefile : str, optional
|
---|---|
Returns: | dframe : pandas.DataFrame
|
Resamples images and clips country boundaries
Parameters: | source_file : str
region : str
sp_res : int or float
prefix : str, optional
nan_value : int, float, optional
dest_nan_value : int or float, optional
variables : list of str, optional
shapefile : str, optional
|
---|---|
Returns: | data : dict of numpy.arrays
lons : numpy.array
lats : numpy.array
gpis : numpy.array
timestamp : datetime.date
|