IHEWAwapor.WPdownload.download package¶
Submodules¶
IHEWAwapor.WPdownload.download.GIS_functions module¶
Created on Tue Jul 30 14:16:35 2019
@author: Bert Coerver
-
IHEWAwapor.WPdownload.download.GIS_functions.CreateGeoTiff(fh, Array, driver, NDV, xsize, ysize, GeoT, Projection, explicit=True, compress=None, print_job=False)[source]¶ Creates a geotiff from a numpy array.
- Parameters
fh (str) – Filehandle for output.
Array (ndarray) – Array to convert to geotiff.
driver (str) – Driver of the fh.
NDV (float) – No-data-value of the fh.
xsize (int) – Amount of pixels in x direction.
ysize (int) – Amount of pixels in y direction.
GeoT (list) – List with geotransform values.
Projection (str) – Projection of fh.
print_job (bool) – Print job details, default True.
-
IHEWAwapor.WPdownload.download.GIS_functions.GetGeoInfo(fh, subdataset=0, print_job=False)[source]¶ Substract metadata from a geotiff, HDF4 or netCDF file.
- Parameters
- Returns
driver (str) – Driver of the fh.
NDV (float) – No-data-value of the fh.
xsize (int) – Amount of pixels in x direction.
ysize (int) – Amount of pixels in y direction.
GeoT (list) – List with geotransform values.
Projection (str) – Projection of fh.
-
IHEWAwapor.WPdownload.download.GIS_functions.MatchProjResNDV(source_file, target_fhs, output_dir, resample='near', dtype='float32', scale=None, ndv_to_zero=False, print_job=False)[source]¶ Matches the projection, resolution and no-data-value of a list of target-files with a source-file and saves the new maps in output_dir.
- Parameters
source_file (str) – The file to match the projection, resolution and ndv with.
target_fhs (list) – The files to be reprojected.
output_dir (str) – Folder to store the output.
resample (str, optional) – Resampling method to use, default is ‘near’ (nearest neighbour).
dtype (str, optional) – Datatype of output, default is ‘float32’.
scale (int, optional) – Multiple all maps with this value, default is None.
print_job (bool) – Print job details, default True.
- Returns
output_files – Filehandles of the created files.
- Return type
-
IHEWAwapor.WPdownload.download.GIS_functions.OpenAsArray(fh, bandnumber=1, dtype='float32', nan_values=False, print_job=False)[source]¶ Open a map as an numpy array.
- Parameters
fh (str) – Filehandle to map to open.
bandnumber (int, optional) – Band or layer to open as array, default is 1.
dtype (str, optional) – Datatype of output array, default is ‘float32’.
nan_values (boolean, optional) – Convert he no-data-values into np.nan values, note that dtype needs to be a float if True. Default is False.
print_job (bool) – Print job details, default True.
- Returns
Array – Array with the pixel values.
- Return type
IHEWAwapor.WPdownload.download.WaporAPI module¶
- Authors: Bich Tran
IHE Delft 2019
Contact: b.tran@un-ihe.org
-
class
IHEWAwapor.WPdownload.download.WaporAPI.WaPOR_API_class(print_job=True)[source]¶ Bases:
objectWaPOR API Class
API Docs
- Parameters
print_job (bool) – Print job details, default True.
-
getAreaTimeseries(shapefile_fh, cube_code, time_range='2009-01-01,2018-12-31', APIToken='')[source]¶ Get Area Timeseries
Do need Authorization
- Parameters
- Returns
timeseries – Area timeseries table.
- Return type
-
getAvailData(cube_code, time_range='2009-01-01,2018-12-31', location=[], season=[], stage=[], version=None, level=None)[source]¶ Get Available Data
- Parameters
cube_code (str) – ex. ‘L2_CTY_PHE_S’.
time_range (str, optional) – ex. ‘2009-01-01,2018-12-31’.
location (list, str, optional) – default: empty list, return all available locations, ex. [‘ETH’].
season (list, str, optional) – default: empty list, return all available seasons, ex. [‘S1’].
stage (list, str, optional) – default: empty list, return all available stages, ex. [‘EOS’,’SOS’].
version (int, optional) – WaPOR workspace version, default 2.
level (int, optional) – Data resolution level, default None.
- Returns
data – Available Data table.
- Return type
-
getCatalog(version=None, level=None, cubeInfo=True)[source]¶ Get catalog from workspace
- Parameters
- Returns
catalog – Catalog table.
- Return type
-
getCropRasterURL(bbox, cube_code, time_code, rasterId)[source]¶ Get Crop Raster Url
Do need Authorization
- Parameters
- Returns
download – Download url.
- Return type
-
getLocations(version=None, level=None)[source]¶ Get Locations
- Parameters
- Returns
locations – Locations table.
- Return type
-
getPixelTimeseries(pixelCoordinates, cube_code, time_range='2009-01-01,2018-12-31')[source]¶ Get Pixel Timeseries
Do not need Authorization
- Parameters
- Returns
timeseries – Point timeseries table.
- Return type
Module contents¶
module for FAO WAPOR API