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
|
-
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
|
-
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
Parameters: | hdflist (list) – python list containing the hdf files |
-
valBound()[source]
Function return the Bounding Box of mosaic
-
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 |
-
valDTD(obj)[source]
Function to add DTDVersion
Parameters: | obj – element to add DTDVersion |
-
valDataCenter(obj)[source]
Function to add DataCenter
Parameters: | obj – element to add DataCenter |
-
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 |
-
valDbID(obj)[source]
Function to add DbID
Parameters: | obj – element to add DbID |
-
valGranuleUR(obj)[source]
Function to add GranuleUR
Parameters: | obj – element to add GranuleUR |
-
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 |
-
valPGEVersion(obj)[source]
Function to add PGEVersion
Parameters: | obj – element to add PGEVersion |
-
valPSA(obj)[source]
Function to add PSA
Parameters: | obj – element to add PSA |
-
valPlatform(obj)[source]
Function to add Platform elements
Parameters: | obj – element to add Platform elements |
-
valRangeTime(obj)[source]
Function to add RangeDateTime
Parameters: | obj – element to add RangeDateTime |
-
writexml(outputname, pretty=True)[source]
Write a xml file for a mosaic
Parameters: |
- outputname (str) – the name of output xml file
- pretty (bool) – write prettyfy output, by default true
|