[GRASS-SVN] r47796 - in grass-addons/grass7/raster/r.modis: .
libmodis r.modis.download
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 21 13:33:38 EDT 2011
Author: lucadelu
Date: 2011-08-21 10:33:38 -0700 (Sun, 21 Aug 2011)
New Revision: 47796
Modified:
grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py
grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html
grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py
grass-addons/grass7/raster/r.modis/r.modis.html
Log:
add more products; improve documentation; improve multiple choose in product option
Modified: grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py
===================================================================
--- grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py 2011-08-21 17:01:42 UTC (rev 47795)
+++ grass-addons/grass7/raster/r.modis/libmodis/rmodislib.py 2011-08-21 17:33:38 UTC (rev 47796)
@@ -45,90 +45,116 @@
"""Definition of MODIS product with url and path in the ftp server
"""
def __init__(self,value = None):
+ # url to download products
urlbase = 'e4ftl01u.ecs.nasa.gov'
usrsnow = 'n4ftl01u.ecs.nasa.gov'
+ ### values of lst product:
lst_spec = '( 1 0 0 0 1 0 0 0 0 0 0 0 )'
lst_specqa = '( 1 1 0 0 1 1 0 0 0 0 0 0 )'
- lstvi_specall = '( 1 1 1 1 1 1 1 1 1 1 1 1)'
+ # pattern for r.bitpatter (key is the pattern option, list of values
+ # contain values for patval option)
lst_patt = {3 : [2, 3], 128 : [81, 85], 255 : [129, 133, 145, 149]}
- lst_suff = {'.LST_Day_1km':'.QC_Day','.LST_Night_1km':'.QC_Night'}
+ # suffix for the lst product (key is the lst map, value the QA)
+ lst1km_suff = {'.LST_Day_1km':'.QC_Day','.LST_Night_1km':'.QC_Night'}
+ lst6km_suff = {'.LST_Day_6km':'.QC_Day','.LST_Night_6km':'.QC_Night'}
+ # color for lst product
lst_color = ['modis_lst']
+ # all the possible layers of lst and vi products, it is used when mosaic it's created
+ lstvi_specall = '( 1 1 1 1 1 1 1 1 1 1 1 1)'
+ ### values of vi product:
vi_spec = '( 1 1 0 0 0 0 0 0 0 0 0 )'
vi_specqa = '( 1 1 1 0 0 0 0 0 0 0 0 )'
vi_patt = {3 : [2, 3], 63 : [13, 14, 15], 128 : [3], 1024 : [1],
8192 : [0, 6, 7], 16384 : [1], 32768 : [1]}
vi_color = ['ndvi','evi']
- vi_suff = {'.250m_16_days_NDVI.tif' : '250m_16_days_VI_Quality.tif',
- '.250m_16_days_EVI.tif' : '250m_16_days_VI_Quality.tif'}
+ vi_suff = {'.250m_16_days_NDVI' : '.250m_16_days_VI_Quality',
+ '.250m_16_days_EVI' : '.250m_16_days_VI_Quality'}
+ ### values of snow product:
snow1_spec = ('( 1 )')
snow1_specqa = ('( 1 1 )')
- snow1suff = {'Snow_Cover_Daily_Tile':'Snow_Spatial_QA'}
+ snow1_suff = {'.Snow_Cover_Daily_Tile':'.Snow_Spatial_QA'}
+ snow1_patt = {3 : [2,3], 7 : [6, 7], 15 : [10, 11, 14, 15]}
snow8_spec = ('( 1 1 )')
- snow8_color = ('evi') #TODO CREATE THE COLOR FOR MODIS_SNOW
+ snow_color = ['evi'] #TODO CREATE THE COLOR FOR MODIS_SNOW
+ snow8_suff = {'.Maximum_Snow_Extent' : None, '.Eight_Day_Snow_Cover' : None}
lstL2_spec = 'LST; QC; Error_LST; Emis_31; Emis_32; View_angle; View_time'
self.prod = value
lst = {'lst_aqua_daily_1000' : {'url' : urlbase, 'folder' : 'MOLA/MYD11A1.005',
'res' : 1000, 'spec' : lst_spec, 'spec_qa' : lst_specqa,
- 'spec_all' : lstvi_specall, 'suff' : lst_suff,
- 'pattern' : lst_patt, 'color' : lst_color},
+ 'spec_all' : lstvi_specall, 'suff' : lst1km_suff,
+ 'pattern' : lst_patt, 'color' : lst_color
+ },
'lst_terra_daily_1000' : {'url' : urlbase, 'folder' : 'MOLT/MOD11A1.005',
'res' : 1000, 'spec': lst_spec,'spec_qa': lst_specqa,
- 'spec_all' : lstvi_specall, 'suff' : lst_suff,
- 'pattern' : lst_patt, 'color' : lst_color},
+ 'spec_all' : lstvi_specall, 'suff' : lst1km_suff,
+ 'pattern' : lst_patt, 'color' : lst_color
+ },
'lst_terra_eight_1000' : {'url' : urlbase, 'folder' : 'MOLT/MOD11A2.005',
'res' : 1000, 'spec': lst_spec,'spec_qa': lst_specqa,
- 'spec_all' : lstvi_specall, 'suff' : lst_suff,
- 'pattern' : lst_patt, 'color' : lst_color},
+ 'spec_all' : lstvi_specall, 'suff' : lst1km_suff,
+ 'pattern' : lst_patt, 'color' : lst_color
+ },
'lst_aqua_eight_1000' : {'url' : urlbase, 'folder' : 'MOLA/MYD11A2.005',
'res' : 1000, 'spec': lst_spec,'spec_qa': lst_specqa,
- 'spec_all' : lstvi_specall, 'suff' : lst_suff,
- 'pattern' : lst_patt, 'color' : lst_color},
+ 'spec_all' : lstvi_specall, 'suff' : lst1km_suff,
+ 'pattern' : lst_patt, 'color' : lst_color
+ },
'lst_terra_daily_6000' : {'url' : urlbase, 'folder' : 'MOLT/MOD11B1.005',
'res' : 6000, 'spec': lst_spec,'spec_qa': lst_specqa,
- 'spec_all' : lstvi_specall, 'suff' : lst_suff,
- 'pattern' : lst_patt, 'color' : lst_color},
+ 'spec_all' : lstvi_specall, 'suff' : lst6km_suff,
+ 'pattern' : lst_patt, 'color' : lst_color
+ },
'lst_aqua_daily_6000' : {'url' : urlbase, 'folder' : 'MOLA/MYD11B1.005',
'res' : 6000, 'spec': lst_spec,'spec_qa': lst_specqa,
- 'spec_all' : lstvi_specall, 'suff' : lst_suff,
- 'pattern' : lst_patt, 'color' : lst_color},
+ 'spec_all' : lstvi_specall, 'suff' : lst6km_suff,
+ 'pattern' : lst_patt, 'color' : lst_color
+ },
}
vi = {'ndvi_terra_sixteen_250':{'url':urlbase, 'folder':'MOLT/MOD13Q1.005',
'res':250,'spec': vi_spec,'spec_qa': vi_specqa,
'spec_all' : lstvi_specall, 'suff' : vi_suff,
'pattern' : vi_patt, 'color' : vi_color
- },
+ },
'ndvi_aqua_sixteen_250':{'url':urlbase, 'folder':'MOLA/MYD13Q1.005',
'res':250,'spec': vi_spec,'spec_qa': vi_specqa,
'spec_all' : lstvi_specall, 'suff' : vi_suff,
'pattern' : vi_patt, 'color' : vi_color
- },
+ },
'ndvi_terra_sixteen_500':{'url':urlbase, 'folder':'MOLT/MOD13A2.005',
'res':500,'spec': vi_spec,'spec_qa': vi_specqa,
'spec_all' : lstvi_specall, 'suff' : vi_suff,
'pattern' : vi_patt, 'color' : vi_color
- },
+ },
'ndvi_aqua_sixteen_500':{'url':urlbase, 'folder':'MOLA/MYD13A2.005',
'res':500,'spec': vi_spec,'spec_qa': vi_specqa,
'spec_all' : lstvi_specall, 'suff' : vi_suff,
'pattern' : vi_patt, 'color' : vi_color
- }
+ }
}
snow = {'snow_terra_daily_500' : {'url' : usrsnow, 'folder' :
'SAN/MOST/MOD10A1.005', 'res' : 500, 'spec' : snow1_spec
- ,'spec_qa': snow1_specqa, 'suff' : snow1suff},
+ ,'spec_qa': snow1_specqa, 'suff' : snow1_suff,
+ 'pattern' : snow1_patt, 'color' : snow_color
+ },
'snow_aqua_daily_500' : {'url' : usrsnow, 'folder' :
'SAN/MOSA/MYD10A1.005', 'res' : 500, 'spec' : snow1_spec
- ,'spec_qa': snow1_specqa, 'suff' : snow1suff},
+ ,'spec_qa': snow1_specqa, 'suff' : snow1_suff,
+ 'pattern' : snow1_patt, 'color' : snow_color
+ },
'snow_terra_eight_500' : {'url' : usrsnow, 'folder' :
'SAN/MOST/MOD10A2.005', 'res' : 500, 'spec' : snow8_spec
- ,'spec_qa': None},
+ ,'spec_qa': None, 'spec_all' : snow8_spec,
+ 'pattern' : None, 'suff' : snow8_suff, 'color' : snow_color
+ },
'snow_aqua_eight_500' : {'url' : usrsnow, 'folder' :
'SAN/MOSA/MYD10A2.005', 'res' : 500, 'spec' : snow8_spec
- ,'spec_qa': None}
- }
+ ,'spec_qa': None, 'spec_all' : snow8_spec,
+ 'pattern' : None, 'suff' : snow8_suff, 'color' : snow_color
+ }
+ }
self.products = { }
self.products.update(lst)
self.products.update(vi)
@@ -279,6 +305,7 @@
return self.datumlist[self.dat]
def datumswath(self):
+ """Return the datum in MRT style"""
return self.datumlist_swath[self.dat]
def utmzone(self):
Modified: grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html
===================================================================
--- grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html 2011-08-21 17:01:42 UTC (rev 47795)
+++ grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.html 2011-08-21 17:33:38 UTC (rev 47796)
@@ -29,17 +29,17 @@
To download LST Terra product using the default options and change the starting and ending dates
<div class="code"><pre>
- r.modis.download setting=/home/user/.grass/r.modis/SETTING startday=2011-05-31 endday=2011-05-01
+ r.modis.download setting=/home/user/.grass/r.modis/SETTING startday=2011-05-01 endday=2011-05-31
</pre></div>
-To downlad another product (for example <em>Snow eight days</em>), with other default options
+To downlad another product (for example <em>Snow eight days 500 m</em>), with other default options
<div class="code"><pre>
- r.modis.download setting=/home/user/.grass/r.modis/SETTING product=snow_terra_eight
+ r.modis.download setting=/home/user/.grass/r.modis/SETTING product=snow_terra_eight_500
</pre></div>
To use <em>r.modis.download</em> in a script with one of the other module you have to set -g flag to return the name of the file containing a list of HDF names downladed
<div class="code"><pre>
- r.modis.download -g setting=/home/user/.grass/r.modis/SETTING startday=2011-05-31 endday=2011-05-01
+ r.modis.download -g setting=/home/user/.grass/r.modis/SETTING startday=2011-05-01 endday=2011-05-31
</pre></div>
<h2>SEE ALSO</h2>
Modified: grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py
===================================================================
--- grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py 2011-08-21 17:01:42 UTC (rev 47795)
+++ grass-addons/grass7/raster/r.modis/r.modis.download/r.modis.download.py 2011-08-21 17:33:38 UTC (rev 47796)
@@ -41,8 +41,9 @@
#% key: product
#% type: string
#% label: Name of MODIS product
+#% multiple: yes
#% required: no
-#% options: lst_terra_daily_1000, lst_aqua_daily_1000, lst_terra_eight_1000, lst_aqua_eight_1000, lst_terra_daily_6000, lst_aqua_daily_6000, ndvi_terra_sixteen_250, ndvi_aqua_sixteen_250, ndvi_terra_sixteen_500, ndvi_aqua_sixteen_500, snow_terra_eight_500
+#% options: lst_terra_daily_1000, lst_aqua_daily_1000, lst_terra_eight_1000, lst_aqua_eight_1000, lst_terra_daily_6000, lst_aqua_daily_6000, ndvi_terra_sixteen_250, ndvi_aqua_sixteen_250, ndvi_terra_sixteen_500, ndvi_aqua_sixteen_500, snow_terra_daily_500, snow_aqua_daily_500, snow_terra_eight_500, snow_aqua_eight_500
#% answer: lst_terra_daily_1000
#%end
#%option
@@ -55,14 +56,14 @@
#% key: startday
#% type: string
#% label: The day to start download.
-#% description: If not set the download stops 10 day before the endday
+#% description: If not set the download starts from today and go back 10 days. If not endday the download stops 10 days after the endday
#% required: no
#%end
#%option
#% key: endday
#% type: string
#% label: The day from stop download.
-#% description: If not set the download starts from today
+#% description: To use only with startday
#% required: no
#%end
#%option
@@ -122,16 +123,16 @@
return None, None, 10
# set only end day
elif options['startday'] != '' and options['endday'] == '':
- today = date.today().strftime("%Y-%m-%d")
- if today >= options['startday']:
- grass.fatal(_('The last day cannot be >= of the first day'))
- return 0
- valueDay, valueEnd, valueDelta = check2day(options['startday'])
+ valueDelta = 10
+ valueEnd = options['startday']
+ firstSplit = valueEnd.split('-')
+ firstDay = date(int(firstSplit[0]),int(firstSplit[1]),int(firstSplit[2]))
+ delta = timedelta(10)
+ lastday = firstDay + delta
+ valueDay = lastday.strftime("%Y-%m-%d")
# set only start day
elif options['startday'] == '' and options['endday'] != '':
- valueDay = options['endday']
- valueEnd = None
- valueDelta = 10
+ grass.fatal(_("It is not possible use <endday> option without <startday> option"))
# set start and end day
elif options['startday'] != '' and options['endday'] != '':
valueDay, valueEnd, valueDelta = check2day(options['startday'],options['endday'])
@@ -180,10 +181,10 @@
if version['version'].find('7.') == -1:
grass.fatal(_('You are not in GRASS GIS version 7'))
return 0
+ # the product
+ products = options['product'].split(',')
# first date and delta
firstday, finalday, delta = checkdate(options)
- # the product
- prod = product(options['product']).returned()
# set tiles
if options['tiles'] == '':
tiles = None
@@ -195,20 +196,22 @@
debug_opt = True
else:
debug_opt = False
- #start modis class
- modisOgg = downModis(url = prod['url'], user = user,password = passwd,
- destinationFolder = fold, tiles = tiles, path = prod['folder'],
- today = firstday, enddate = finalday, delta = delta, debug = debug_opt)
- # connect to ftp
- modisOgg.connectFTP()
- # download tha tiles
- grass.message(_("Downloading MODIS product..."))
- modisOgg.downloadsAllDay()
- if flags['g']:
- grass.message(modisOgg.filelist.name)
- else:
- grass.message(_("All data are downloaded, now you can use "\
- + "r.in.modis.import or with option 'conf=%s'" % modisOgg.filelist.name))
+ for produ in products:
+ prod = product(produ).returned()
+ #start modis class
+ modisOgg = downModis(url = prod['url'], user = user,password = passwd,
+ destinationFolder = fold, tiles = tiles, path = prod['folder'],
+ today = firstday, enddate = finalday, delta = delta, debug = debug_opt)
+ # connect to ftp
+ modisOgg.connectFTP()
+ # download tha tiles
+ grass.message(_("Downloading MODIS product..."))
+ modisOgg.downloadsAllDay()
+ if flags['g']:
+ grass.message(modisOgg.filelist.name)
+ else:
+ grass.message(_("All data are downloaded, now you can use "\
+ + "r.in.modis.import or with option 'files=%s'" % modisOgg.filelist.name))
if __name__ == "__main__":
options, flags = grass.parser()
Modified: grass-addons/grass7/raster/r.modis/r.modis.html
===================================================================
--- grass-addons/grass7/raster/r.modis/r.modis.html 2011-08-21 17:01:42 UTC (rev 47795)
+++ grass-addons/grass7/raster/r.modis/r.modis.html 2011-08-21 17:33:38 UTC (rev 47796)
@@ -19,20 +19,85 @@
<h4>Products</h4>
The products already supported:
<ul>
- <li>Land Surface Temperature daily (Terra): product provides per-pixel temperature
+ <li><b>Land Surface Temperature daily 1 Km (Terra/Aqua)</b>: product provides per-pixel temperature
and emissivity values in a sequence of swath-based to grid-based global products.
- The MODIS/Terra LST/E Daily L3 Global 1 km Grid product (MOD11A1), is tile-based
+ The MODIS/Terra-Aqua LST/E Daily L3 Global 1 km Grid product (MOD11A1/MYD11A1), is tile-based
and gridded in the Sinusoidal projection, and produced daily at 1 km spatial resolution. </li>
- <li>Land Surface Temperature daily (Aqua): product provides per-pixel temperature and
- emissivity values in a sequence of swath-based to grid-based global products.
- The MODIS/Aqua LST/E Daily L3 Global 1 km Grid product (MYD11A1), is tile-based
- and gridded in the Sinusoidal projection, and produced daily at 1 km spatial resolution.</li>
- <li>NDVI sixteen days (Terra): MODIS Normalized Difference Vegetation Index (NDVI)
- complements NOAA's Advanced Very High Resolution Radiometer (AVHRR) NDVI products
- and provides continuity for time series historical applications. data are provided
- every 16 days at 250-meter spatial resolution as a gridded level-3 product (MOD13Q1)
- in the Sinusoidal projection.</li>
- <li>Snow eight days: </li>
+ <li><b>Land Surface Temperature daily 6 Km (Terra/Aqua)</b>: data are composed from the daily
+ 1-kilometer LST product (MOD11A1/MYD11A1) and stored on a 1-km Sinusoidal grid as the
+ average values of clear-sky LSTs during an 8-day period.<br>
+ MOD11A2/MYD11A2 is comprised of daytime and nighttime LSTs, quality assessment,
+ observation times, view angles, bits of clear sky days and nights, and
+ emissivities estimated in Bands 31 and 32 from land cover types.</li>
+ <li><b>Land Surface Temperature eight day 1 Km (Terra/Aqua)</b>: products provide per-pixel
+ temperature and emissivity values in a sequence of swath-based to grid-based
+ global products. The MODIS/Terra-Aqua LST/E Daily L3 Global 5 Km Grid
+ (Short name: MOD11B1/MYD11B1), is tile-based and gridded in the Sinusoidal projection,
+ and produced daily at 5 km spatial resolution.</li>
+ <li><b>VI sixteen days 250 m (Terra/Aqua)</b>: Global MODIS vegetation indices are designed
+ to provide consistent spatial and temporal comparisons of vegetation conditions.
+ Blue, red, and near-infrared reflectances, centered at 469-nanometers,
+ 645-nanometers, and 858-nanometers, respectively, are used to determine
+ the MODIS daily vegetation indices.<br>
+ The MODIS Normalized Difference Vegetation Index (NDVI) complements NOAA's
+ Advanced Very High Resolution Radiometer (AVHRR) NDVI products and provides
+ continuity for time series historical applications. MODIS also includes a
+ new Enhanced Vegetation Index (EVI) that minimizes canopy background variations
+ and maintains sensitivity over dense vegetation conditions. The EVI also
+ uses the blue band to remove residual atmosphere contamination caused by
+ smoke and sub-pixel thin cloud clouds. The MODIS NDVI and EVI products are
+ computed from atmospherically corrected bi-directional surface reflectances
+ that have been masked for water, clouds, heavy aerosols, and cloud shadows.
+ Global MOD13Q1/MYD13Q1 data are provided every 16 days at 250-meter spatial resolution
+ as a gridded level-3 product in the Sinusoidal projection. Lacking a 250m
+ blue band, the EVI algorithm uses the 500m blue band to correct for residual
+ atmospheric effects, with negligible spatial artifacts.</li>
+ <li><b>VI sixteen days 500 m (Terra/Aqua)</b>: Global MODIS vegetation indices are
+ designed to provide consistent spatial and temporal comparisons of vegetation
+ conditions. Blue, red, and near-infrared reflectances, centered at
+ 469-nanometers, 645-nanometers, and 858-nanometers, respectively, are used
+ to determine the MODIS daily vegetation indices.<br>
+ The MODIS Normalized Difference Vegetation Index (NDVI) complements NOAA's
+ Advanced Very High Resolution Radiometer (AVHRR) NDVI products provide
+ continuity for time series historical applications. MODIS also includes a
+ new Enhanced Vegetation Index (EVI) that minimizes canopy background
+ variations and maintains sensitivity over dense vegetation conditions.
+ The EVI also uses the blue band to remove residual atmosphere contamination
+ caused by smoke and sub-pixel thin cloud clouds. The MODIS NDVI and EVI
+ products are computed from atmospherically corrected bi-directional surface
+ reflectances that have been masked for water, clouds, heavy aerosols, and
+ cloud shadows.<br>
+ Global MOD13A1/MYD13A1 data are provided every 16 days at 500-meter spatial
+ resolution as a gridded level-3 product in the Sinusoidal projection.
+ Vegetation indices are used for global monitoring of vegetation conditions
+ and are used in products displaying land cover and land cover changes.
+ These data may be used as input for modeling global biogeochemical and
+ hydrologic processes and global and regional climate. These data also may
+ be used for characterizing land surface biophysical properties and processes,
+ including primary production and land cover conversion.</li>
+ <li><b>Snow eight days 500 m (Terra/Aqua)</b>: The MOD10A2 and MYD10A2 products
+ are composites of eight days of snow maps in the sinusoidal grid.
+ An eight-day compositing period was chosen because that is the exact ground
+ track repeat period of the Terra and Aqua platforms. Snow cover over eight
+ days is mapped as maximum snow extent in one SDS and as a chronology of
+ observations in the other SDS. Eight-day periods begin on the first day of
+ the year and extend into the next year. The product can be produced with
+ two to eight days of input. There may not always be eight days of input,
+ because of various reasons, so the user should check the attributes to
+ determine on what days observations were obtained. See the validation webpage
+ for details on the validation and validation definitions.</li>
+ <li><b>Snow daily 500 m (Terra/Aqua)</b>: MOD10A1 and MYD10A1 are tiles of daily
+ snow cover at 500 m spatial resolution. The daily observation selected from
+ multiple observations in a MOD10A1 (or MYD10A1) cell is the observation
+ acquired nearest nadir and having the greatest coverage of the grid cell.
+ The daily MOD10A1 and MYD10A1 snow products are tiles of data gridded in the
+ sinusoidal projection. Tiles are approximately 1200 x 1200 km in area. A
+ single scientific data set (SDS) of snow cover and a single SDS of QA data
+ along with local and global attributes comprise the data product file. The
+ daily level 3 snow product is the result of selecting an observation from
+ the multiple observations mapped to a cell of the MOD10_L2G (or MYD10_L2G)
+ product. See the validation webpage for details on the validation and
+ validation definitions.</li>
</ul>
<h2>SEE ALSO</h2>
@@ -40,6 +105,10 @@
<li> <a href="r.modis.download.html">r.modis.download</a>: Download MODIS HDF products from NASA FTP</li>
<li> <a href="r.modis.import.html">r.modis.import</a>: Import Level 3 MODIS products as
single image or daily mosaik into GRASS GIS</li>
+ <li> <a href="http://modis-land.gsfc.nasa.gov/index.htm">MODIS Land homepage</a><li>
+ <li> <a href="http://modis-snow-ice.gsfc.nasa.gov/">MODIS Snow homepage</a><li>
+ <li> <a href="https://lpdaac.usgs.gov/lpdaac/products/modis_products_table">MODIS Land products table</a><li>
+
<!-- <li> <a href="r.modis.process.html">r.modis.process</a>: Calculates range
of patch area size on a raster map</li>-->
</ul>
More information about the grass-commit
mailing list