convertmodis_gdal
module¶
Convert MODIS HDF file using GDAL Python bindings. It can create GeoTiff file (or other GDAL supported formats) or HDF mosaic file for several tiles.
Classes:
Functions:
-
class
pymodis.convertmodis_gdal.
convertModisGDAL
(hdfname, prefix, subset, res, outformat='GTiff', epsg=None, wkt=None, resampl='NEAREST_NEIGHBOR', vrt=False)[source]¶ Bases:
object
A class to convert modis data from hdf to GDAL formats using GDAL
- Parameters
hdfname (str) – name of input data
prefix (str) – prefix for output data
subset (str) – the subset to consider
res (int) – output resolution
outformat (str) – output format, it is possible to use all the supported GDAL format
epsg (int) – the EPSG code for the preojection of output file
wkt (str) – the WKT string for the preojection of output file
resampl (str) – the resampling method to use
vrt (bool) – True to read GDAL VRT file created with createMosaicGDAL
-
class
pymodis.convertmodis_gdal.
createMosaicGDAL
(hdfnames, subset, outformat='HDF4Image')[source]¶ Bases:
object
A class to mosaic modis data from hdf to GDAL formats using GDAL
- Parameters
-
run
(output, quiet=False)[source]¶ Create the mosaic
- Parameters
output (str) – the name of output file
-
class
pymodis.convertmodis_gdal.
file_info
[source]¶ Bases:
object
A class holding information about a GDAL file.
Class copied from gdal_merge.py
- Parameters
filename (str) – Name of file to read.
- Returns
1 on success or 0 if the file can’t be opened.
-
copy_into
(t_fh, s_band=1, t_band=1, nodata_arg=None)[source]¶ Copy this files image into target file.
This method will compute the overlap area of the file_info objects file, and the target gdal.Dataset object, and copy the image data for the common window area. It is assumed that the files are in a compatible projection. no checking or warping is done. However, if the destination file is a different resolution, or different image pixel type, the appropriate resampling and conversions will be done (using normal GDAL promotion/demotion rules).
- Parameters
t_fh – gdal.Dataset object for the file into which some or all of this file may be copied.
s_band –
t_band –
nodata_arg –
- Returns
1 on success (or if nothing needs to be copied), and zero one failure.
-
pymodis.convertmodis_gdal.
getResampling
(res)[source]¶ Return the GDAL resampling method
- Parameters
res (str) – the string of resampling method