You may have noticed that the file names include the string doy followed by 7 digits. List_files = glob.glob(pathname = "./MOD*FireMask*", recursive=True) A convenient way to get such a list is by using the pathname pattern expansion offered by the glob function. To import the MOD14A data layers, you need to create a list with all the file names of the MOD14A layers. Again, this is only useful if you plan to keep the imported layers. These will later be used to define the colors scheme of the imported layers. Optionally, you can prepare the color definition rules. # Categories satellite dataġ|Not processed (obsolete not used since Collection 1)Ĩ|Fire (nominal confidence, land or water) Obviously, this step is only useful if you plan to keep the imported layers. These will later be used to define the labels of the imported layers using the r.category function. #PYTHON COMMANDS FOR GRASS GIS CODE#The code below defines the labels of each of these categories. These categories are described in the metadata. The Firemask layers have 9 categories, including a number of not processed, non-fire and fire categories. # Import librariesįrom dateutil.relativedelta import relativedelta Next, define the working directory with the downloaded Geotif files. Now, the first step is to import the required libraries. To run a Python script, open GRASS GIS’s own Python editor, or start up your favorite editor from the GRASS GIS command line. If you are not familiar with the temporal data processing framework, I suggest you first read this overview. To use them, you need to register the layers in a grass gis space-time raster dataset ( strds). GRASS GIS has advanced temporal data processing functions. Just be aware that it may take a bit of time to download the data. I used the code in this post to create a fire frequency map for the TAL, a region covering the lowlands of Nepal and an area in the north of India. Luckily, with just a bit of Python code, this can be automated. Importing and registring all these data layers by hand is a bit much. However, it makes life a lot easier, especially if at a later stage you want to do more temporal analyses. 5, 6 Mind you, you could do without the last step. You’ll first have to import 900+ MYD14A2 and MOD14A2 images into a GRASS GIS database, 4 and then register them in a time-space data-set. The tricky bit, as is often the case, is to get all the data in order. 1– 3 As input, the 8-day composite products, available from 2002 to February 2022, will be used.Ĭalculating the fire frequencies is easy enough. #PYTHON COMMANDS FOR GRASS GIS HOW TO#In this post, I’ll show how to calculate the yearly fire frequency based on the Moderate Resolution Imaging Spectroradiometer (MODIS) MYD14A2 and MOD14A2 products.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |