parsemodis
module¶
Simple class to parse MODIS metadata file, it can also write the XML metadata file for a mosaic.
Classes:
-
class
pymodis.parsemodis.
parseModis
(filename)[source]¶ Class to parse MODIS xml files, it can also create the parameter configuration file for resampling MODIS DATA with the MRT software or convertmodis Module
Parameters: filename (str) – the name of MODIS hdf file -
confResample
(spectral, res=None, output=None, datum='WGS84', resample='NEAREST_NEIGHBOR', projtype='GEO', utm=None, projpar='( 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 )', bound=None)[source]¶ Create the parameter file to use with resample MRT software to create tif (geotiff) file
Parameters: - spectral (str) –
the spectral subset to be used, see the product table to understand the layer that you want use. For example:
- NDVI ( 1 1 1 0 0 0 0 0 0 0 0 0) copy only layer NDVI, EVI and QA VI the other layers are not used
- LST ( 1 1 0 0 1 1 0 0 0 0 0 0 ) copy only layer daily and nightly temperature and QA
- res (int) – the resolution for the output file, it must be set in the map unit of output projection system. The software will use the original resolution of input file if res not set
- output (str) – the output name, if not set if not set the prefix name of input hdf file will be used
- utm – the UTM zone if projection system is UTM
- resample (str) –
the type of resampling, the valid values are:
- NN (nearest neighbor)
- BI (bilinear)
- CC (cubic convolution)
- projtype (str) –
the output projection system, valid values are:
- AEA (Albers Equal Area)
- ER (Equirectangular)
- GEO (Geographic Latitude/Longitude)
- HAM (Hammer)
- ISIN (Integerized Sinusoidal)
- IGH (Interrupted Goode Homolosine)
- LA (Lambert Azimuthal)
- LCC (LambertConformal Conic)
- MERCAT (Mercator)
- MOL (Mollweide)
- PS (Polar Stereographic)
- SIN (Sinusoidal)
- UTM (Universal TransverseMercator)
- datum (str) –
the datum to use, the valid values are:
- NAD27
- NAD83
- WGS66
- WGS76
- WGS84
- NODATUM
- projpar (str) – a list of projection parameters, for more info check the Appendix C of MODIS reprojection tool user manual https://lpdaac.usgs.gov/content/download/4831/22895/file/mrt41_usermanual_032811.pdf
- bound (dict) –
dictionary with the following keys:
- max_lat
- max_lon
- min_lat
- min_lon
- spectral (str) –
-
confResample_swath
(sds, geoloc, res, output=None, sphere='8', resample='NN', projtype='GEO', utm=None, projpar='0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0', bound=None)[source]¶ - Create the parameter file to use with resample MRT software to
- create tif (geotiff) file
Parameters: - sds (str) – Name of band/s (Science Data Set) to resample
- geoloc (str) – Name geolocation file (example MOD3, MYD3)
- res (int) – the resolution for the output file, it must be set in the map unit of output projection system. The software will use the original resolution of input file if res not set
- output (str) – the output name, if not set the prefix name of input hdf file will be used
- sphere (int) –
Output sphere number. Valid options are:
- 0=Clarke 1866
- 1=Clarke 1880
- 2=Bessel
- 3=International 1967
- 4=International 1909
- 5=WGS 72
- 6=Everest
- 7=WGS 66
- 8=GRS1980/WGS 84
- 9=Airy
- 10=Modified Everest
- 11=Modified Airy
- 12=Walbeck
- 13=Southeast Asia
- 14=Australian National
- 15=Krassovsky
- 16=Hough
- 17=Mercury1960
- 18=Modified Mercury1968
- 19=Sphere 19 (Radius 6370997)
- 20=MODIS Sphere (Radius 6371007.181)
- resample (str) –
the type of resampling, the valid values are:
- NN (nearest neighbor)
- BI (bilinear)
- CC (cubic convolution)
- projtype (str) –
the output projection system, valid values are:
- AEA (Albers Equal Area)
- ER (Equirectangular)
- GEO (Geographic Latitude/Longitude)
- HAM (Hammer)
- ISIN (Integerized Sinusoidal)
- IGH (Interrupted Goode Homolosine)
- LA (Lambert Azimuthal)
- LCC (LambertConformal Conic)
- MERCAT (Mercator)
- MOL (Mollweide)
- PS (Polar Stereographic),
- SIN ()Sinusoidal)
- UTM (Universal TransverseMercator)
- utm – the UTM zone if projection system is UTM
- projpar (str) – a list of projection parameters, for more info check the Appendix C of MODIS reprojection tool user manual https://lpdaac.usgs.gov/content/download/4831/22895/file/mrt41_usermanual_032811.pdf
- bound (dict) –
dictionary with the following keys:
- max_lat
- max_lon
- min_lat
- min_lon
-
retInputGranule
()[source]¶ Return the input files (InputGranule) used to process the considered file
-
-
class
pymodis.parsemodis.
parseModisMulti
(hdflist)[source]¶ A class to obtain some variables for the xml file of several MODIS tiles. It can also create the xml file
Parameters: hdflist (list) – python list containing the hdf files -
valBrowseProduct
(obj)[source]¶ Function to add BrowseGranuleId
Parameters: obj – element to add BrowseGranuleId
-
valCollectionMetaData
(obj)[source]¶ Function to add CollectionMetaData
Parameters: obj – element to add CollectionMetaData
-
valDataFiles
(obj)[source]¶ Function to add DataFileContainer
Parameters: obj – element to add DataFileContainer
-
valDataGranule
(obj)[source]¶ Function to add DataFileContainer
Parameters: obj – element to add DataFileContainer
-
valInputPointer
(obj)[source]¶ Function to add InputPointer
Parameters: obj – element to add InputPointer
-
valInsTime
(obj)[source]¶ Function to add the minimum of InsertTime
Parameters: obj – element to add InsertTime
-
valInsertTime
(obj)[source]¶ Function to add InsertTime elements
Parameters: obj – element to add InsertTime elements
-
valLastUpdate
(obj)[source]¶ Function to add LastUpdate elements
Parameters: obj – element to add LastUpdate elements
-
valMeasuredParameter
(obj)[source]¶ Function to add ParameterName
Parameters: obj – element to add ParameterName
-
valPlatform
(obj)[source]¶ Function to add Platform elements
Parameters: obj – element to add Platform elements
-