parsemodis module
Simple class to parse MODIS metadata file, it can also write the XML metadata file for a mosaic.
-
class pymodis.parsemodis.parseModis(filename)[source]
Class to parse MODIS xml files, it also can create the parameter
configuration file for resampling MODIS DATA with the MRT software or
convertmodis Module
-
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 file
spectral = the spectral subset to be used, look 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 = 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 it isn’t set
output = the output name, if it doesn’t set will use the prefix name
of input hdf file
utm = the UTM zone if projection system is UTM
- resample = the type of resampling, the valid values are:
- NN (nearest neighbor)
- BI (bilinear)
- CC (cubic convolution)
- projtype = the output projection system, the 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 = the datum to use, the valid values are:
- NAD27
- NAD83
- WGS66
- WGS76
- WGS84
- NODATUM
projpar = 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 = dictionary with the following keys:
- max_lat
- max_lon
- min_lat
- min_lon
-
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 file
sds = Name of band/s (Science Data Set) to resample
geoloc = Name geolocation file (example MOD3, MYD3)
res = 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 it isn’t set
output = the output name, if it doesn’t set will use the prefix name
of input hdf file
- sphere = 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 = the type of resampling, the valid values are:
- NN (nearest neighbor)
- BI (bilinear)
- CC (cubic convolution)
- projtype = the output projection system, the 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 = 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 = dictionary with the following keys:
- max_lat
- max_lon
- min_lat
- min_lon
-
getGranule()[source]
Set the GranuleURMetaData element
-
getRoot()[source]
Set the root element
-
retBoundary()[source]
Return the maximum extend (Bounding Box) of the MODIS file as
dictionary
-
retBrowseProduct()[source]
Return the BrowseProduct element
-
retCollectionMetaData()[source]
Return the CollectionMetaData element as dictionary
-
retDTD()[source]
Return the DTDVersion element
-
retDataCenter()[source]
Return the DataCenterId element
-
retDataFiles()[source]
Return the DataFiles element as dictionary
-
retDataGranule()[source]
Return the ECSDataGranule elements as dictionary
-
retDbID()[source]
Return the DbID element
-
retGranuleUR()[source]
Return the GranuleUR element
-
retInputGranule()[source]
Return the input files (InputGranule) used to process the considered
file
-
retInsertTime()[source]
Return the InsertTime element
-
retLastUpdate()[source]
Return the LastUpdate element
-
retMeasure()[source]
Return statistics of QA as dictionary
-
retPGEVersion()[source]
Return the PGEVersion element
-
retPSA()[source]
Return the PSA values as dictionary, the PSAName is the key and
and PSAValue is the value
-
retPlatform()[source]
Return the platform values as dictionary.
-
retRangeTime()[source]
Return the RangeDateTime elements as dictionary
-
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
-
valBound()[source]
Function return the Bounding Box of mosaic
-
valCollectionMetaData(obj)[source]
Function to add CollectionMetaData
obj = element to add CollectionMetaData
-
valDTD(obj)[source]
Function to add DTDVersion
obj = element to add DTDVersion
-
valDataCenter(obj)[source]
Function to add DataCenter
obj = element to add DataCenter
-
valDataFiles(obj)[source]
Function to add DataFileContainer
obj = element to add DataFileContainer
-
valDbID(obj)[source]
Function to add DbID
obj = element to add DbID
-
valGranuleUR(obj)[source]
Function to add GranuleUR
obj = element to add GranuleUR
-
valInputPointer(obj)[source]
Function to add InputPointer
obj = element to add InputPointer
-
valInsTime(obj)[source]
Function to add the minimum of InsertTime
obj = element to add InsertTime
-
valMeasuredParameter(obj)[source]
Function to add ParameterName
obj = element to add ParameterName
-
valPGEVersion(obj)[source]
Function to add PGEVersion
obj = element to add PGEVersion
-
valPlatform(obj)[source]
Function to add Platform elements
obj = element to add Platform elements
-
valRangeTime(obj)[source]
Function to add RangeDateTime
obj = element to add RangeDateTime
-
writexml(outputname)[source]
Write a xml file for a mosaic
outputname = the name of xml file