full_example_gdal.rst 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Example of a full process with GDAL library
  2. ===========================================
  3. In this short example you will learn how to run a series of
  4. scripts to obtain a GeoTIFF file for each band of the
  5. chosen product using as backend GDAL library.
  6. .. warning::
  7. This example is based on a Linux based system. If you use
  8. another operating system you need to change the paths where data will be saved
  9. .. _download-data:
  10. Downloading data
  11. ----------------
  12. For first you need to obtain data, so you need to use :doc:`../scripts/modis_download`
  13. .. warning::
  14. Remember to register in the NASA portal following the instructions at :ref:`userpw-label` session
  15. ::
  16. mkdir $HOME/tmp
  17. modis_download.py -I -f 2012-12-05 -O -t h28v05,h29v05,h28v04 $HOME/tmp
  18. .. warning::
  19. In this example we are working on the spatial extent of Italy:
  20. for your area of interest, change the tile name(s) according to your region.
  21. User and password are passed through standard input.
  22. We are going to download data for only one day (2012-12-05) using the option "-O".
  23. Inside the ``$HOME/tmp/`` directory you will find a file called *listfileMOD11A1.005.txt*
  24. containing the names of downloaded files. The name of file is related to
  25. the product that you want to download.
  26. .. warning::
  27. Every time that you download new files of the same product they will be overwritten,
  28. so if you need them, you must rename the file before.
  29. Mosaic data
  30. -----------
  31. At this point you need to create the mosaic of the tiles downloaded.
  32. :doc:`../scripts/modis_mosaic` is the script to use. We create a *VRT*
  33. file (``flag -v``) to improve the speed of analysis, without losing any data
  34. only for the first layer ::
  35. modis_mosaic.py -s "1" -o $HOME/tmp/mosaic -v $HOME/tmp/listfileMOD11A1.005.txt
  36. The command will create a file called ``mosaic_LST_Day_1km.vrt`` in $HOME/tmp/
  37. directory
  38. Convert data
  39. ------------
  40. The last part of the procedure is to convert the mosaic using
  41. :doc:`../scripts/modis_convert`. Using *VRT* format it create dataset
  42. of only one later, so you are forced to use ``-s "( 1 )"``. The
  43. following command create a GeoTIFF file called
  44. final_mosaic_LST_Day_1km.vrt.tif ::
  45. modis_convert.py -v -s "( 1 )" -o $HOME/tmp/final -e 4326 $HOME/tmp/mosaic_LST_Day_1km.vrt