Sign inSign up

earthlab/firedpy

By earthlab

•Updated about 4 years ago

A Python CLI for classifying fire events from the Collection 6 MODIS Burned Area Product

Image
0

10K+

earthlab/firedpy repository overview

DOI Docker Automated build GitHub contributors GitHub issues GitHub commit activity

⁠firedpy - FIRe Event Delineation for python

A Python Command Line Interface for classifying fire events from the Collection 6 MODIS Burned Area Product.

This package uses a space-time window to classify individual burn detections from late 2001 to near-present into discrete events and return both a data table and shapefiles of these events. The user is able to specify the spatial and temporal parameters of the window, as well as the area of interest using either a shapefile or a list of MODIS Sinusoidal Projection tile IDs. Shapefiles include full- and daily-level event polygons, providing a representation of both final and expanding event perimeters. Any area from the world may be selected. However, in the current version, memory constraints may limit the extent available for a single model run. This version is calibrated to handle the Contiguous United States (CONUS) on a machine with 16 GB of RAM, though work is underway to move more processing to disk for larger areas. Equatorial regions have much more fire activity, and will require much more RAM to process at this point in time, than a normal laptop will have.

More methodological information is at:

Balch, J. K., St. Denis, L. A., Mahood, A. L., Mietkiewicz, N. P., Williams, T. P., McGlinchy J, and Cook, M. C. 2020. FIRED (Fire Events Delineation): An open, flexible algorithm & database of U.S. fire events derived from the MODIS burned area product (2001-19). Remote Sensing, 12(21), 3498; https://doi.org/10.3390/rs12213498⁠

Already-created products are housed in the CU Scholar data repository in the Earth Lab Data collection.

https://scholar.colorado.edu/collections/pz50gx05h⁠

As of July 15, 2021, we currently have:

  • Coterminous USA + Alaska up to March 2021
  • Western hemisphere from Jan 2017 to March 2020, intended for use in conjunction with GOES16 active fire detections.
  • Bolivia to May 2021

⁠Installation

There are two ways to install firedpy. Method one is to run it out of a docker container, Method 2 is to install locally.

⁠Method 1. Run from a Docker Container:
⁠1.1 Get the docker container running:
  • docker run -t -d earthlab/firedpy

  • Call docker ps to get the name of the docker container you just created.

  • Then get into the docker container by running docker exec:

    docker exec -it <silly_name> /bin/bash

  • Then you will be inside of the docker container in the firedpy directory. Now, enter:

    conda activate firedpy

    And the environment is ready to use.

⁠1.2 Copy firedpy outputs to your local machine

After creating a new fire product, it might be useful to get it out of the docker container in order to use it.

  • First, exit the docker container by typing

    exit

  • Second, copy the file out. Here we will use the example of a container with the name "unruffled_clarke". The docker cp command uses the syntax docker cp <source> <destination>. Files inside of a docker container will have a prefix of the docker container name (or container ID) followed by a colon, then with a normal path.

    Here is an example command using the container name:

    docker cp unruffled_clarke:/home/firedpy/proj/outputs/shapefiles/fired_events_s5_t11_2020153.gpkg /home/Documents/fired_events_s5_t11_2020153.gpkg

    Another example command using the container ID:

    docker cp fa73c6d3e007:/home/firedpy/proj/outputs/shapefiles/fired_events_s5_t11_2020153.gpkg /home/Documents/fired_events_s5_t11_2020153.gpkg

⁠Method 2. Local Installation Instructions:
  • Clone this repository to a local folder and change directories into it:

    git clone https://github.com/earthlab/firedpy.git

    cd firedpy

  • Create and activate a conda environment:

    conda env create -f environment.yaml

    conda activate firedpy

  • Install locally:

    python setup.py install

⁠Use:

  • In your terminal use this command to print out the available options and their descriptions:

    firedpy --help

  • Run firedpy with no options to download required data and write a data table of classified fire events to a temporary directory. This uses CONUS as the default area of interest with a spatial parameter of 5 pixels (~2.3 km) and 11 days:

    firedpy

  • Change the spatial and temporal parameters of the model run:

    firedpy -spatial 6 -temporal 10

  • Specify specific tiles and a local project_directory for required data and model outputs:

    firedpy -spatial 6 -temporal 10 -tiles h11v09 h12v09 -proj_dir /home/<user>/fired_project

  • Write shapefiles as outputs in addition to the data table:

    firedpy -spatial 6 -temporal 10 -tiles h11v09 h12v09 -proj_dir /home/<user>/fired_project --shapefile

  • Add the most common level 3 Ecoregion as an attribute to each event:

    firedpy -spatial 6 -temporal 10 -tiles h11v09 h12v09 -proj_dir /home/<user>/fired_project --shapefile -ecoregion_level 3

  • Add landcover information and produce the daily burn file

    firedpy -spatial 6 -temporal 10 -tiles h11v09 h12v09 -proj_dir /home/<user>/fired_project --shapefile -ecoregion_level 3 -landcover_type 1 -daily yes

For more information about each parameter, use:

'firedpy --help'
⁠Parameter table (under construction)
parametervalue(s)exampledescription
-spatialinteger-spatial 5pixel radius for moving window, defaults to 5
-temporalinteger-temporal 11day radius for moving window, defaults to 11
-tilescharacter (MODIS tile)-tiles h11v09which modis tiles should be used
character (shapefile)-tiles figures out which modis tiles to download based on
-proj_dircharacter-proj_dir /home/firedpy/projwhich directory should firedpy operate within? Defaults to a folder called "proj" within the current working directory.
-ecoregion_typecharacter-ecoregion_type natype of ecoregion, either world or na
-ecoregion_levelinteger-ecoregion_level 3if ecoregion type = na, the level (1-3) of North American ecoregions
-landcover_typeinteger-landcover_type 2number (1-3) corresponding with a MODIS/Terra+Aqua Land Cover (MCD12Q1) category
-shapefilecharacter-shapefile gpkgoption to build a shapefile for the fired event in gpkg, ESRI shapefile (shp), both, or none
-filecharacter-file fired_coloradospecifies the base of the file name for the tables and shapefile outputs, defaults to "fired", in the format: "(-file aruguement)toYYYYDDD(either events or daily).gpkg", with YYYY being the year, and DDD being the julian day of the last month in the time series. The example would output fired_colorado_to2021031_events.gpkg.
-dailycharacter (yes or no)-daily yescreates daily polygons, if no just the event-level perimeters will be created. Defaults to no.
-start_yrinteger-start_yr 2001gets the hdf files from the MODIS tiles starting in this year. The first year avalible is 2001
-end_yrinteger-end_yr 2021gets the hdf files from the MODIS tiles ending in this year. The last year avalible is 2021
⁠Boundary files are available for use as regions of interest
  • Country boundaries are in ref/individual_countries
  • Continent boundaries are in ref/continents
  • State boundaries for the United States of America are in ref/us_states
  • For example firedpy -tiles ref/us_states/colorado.gpkg, and so on.
⁠Country boundary files
Country NameCountry Name
afghanistan.gpkgliberia.gpkg
afghanistan.gpkg-shmlibya.gpkg
afghanistan.gpkg-walliechtenstein.gpkg
aland.gpkglithuania.gpkg
albania.gpkgluxembourg.gpkg
algeria.gpkgmacao_s.a.r.gpkg
american_samoa.gpkgmacedonia.gpkg
andorra.gpkgmadagascar.gpkg
angola.gpkgmalawi.gpkg
anguilla.gpkgmalaysia.gpkg
antarctica.gpkgmaldives.gpkg
antigua_and_barbuda.gpkgmali.gpkg
argentina.gpkgmalta.gpkg
armenia.gpkgmarshall_islands.gpkg
aruba.gpkgmauritania.gpkg
ashmore_and_cartier_islands.gpkgmauritius.gpkg
australia.gpkgmexico.gpkg
austria.gpkgmoldova.gpkg
azerbaijan.gpkgmonaco.gpkg
bahrain.gpkgmongolia.gpkg
bangladesh.gpkgmontenegro.gpkg
barbados.gpkgmontserrat.gpkg
belarus.gpkgmorocco.gpkg
belgium.gpkgmozambique.gpkg
belize.gpkgmyanmar.gpkg
benin.gpkgnamibia.gpkg
bermuda.gpkgnauru.gpkg
bhutan.gpkgnepal.gpkg
bolivia.gpkgnetherlands.gpkg
bosnia_and_herzegovina.gpkgnew_caledonia.gpkg
botswana.gpkgnew_zealand.gpkg
brazil.gpkgnicaragua.gpkg
british_indian_ocean_territory.gpkgniger.gpkg
british_virgin_islands.gpkgnigeria.gpkg
brunei.gpkgniue.gpkg
bulgaria.gpkgnorfolk_island.gpkg
burkina_faso.gpkgnorth_korea.gpkg
burundi.gpkgnorthern_cyprus.gpkg
cabo_verde.gpkgnorthern_mariana_islands.gpkg
cambodia.gpkgnorway.gpkg
cameroon.gpkgoman.gpkg
canada.gpkgpakistan.gpkg
cayman_islands.gpkgpalau.gpkg
central_african_republic.gpkgpalestine.gpkg
chad.gpkgpanama.gpkg
chile.gpkgpapua_new_guinea.gpkg
china.gpkgparaguay.gpkg
colombia.gpkgperu.gpkg
comoros.gpkgphilippines.gpkg
cook_islands.gpkgpitcairn_islands.gpkg
costa_rica.gpkgpoland.gpkg
croatia.gpkgportugal.gpkg
cuba.gpkgpuerto_rico.gpkg
curaçao.gpkgqatar.gpkg
cyprus.gpkgrepublic_of_serbia.gpkg
czechia.gpkgrepublic_of_the_congo.gpkg
democratic_republic_of_the_congo.gpkgromania.gpkg
denmark.gpkgrussia.gpkg
djibouti.gpkgrwanda.gpkg
dominica.gpkgsaint_barthelemy.gpkg
dominican_republic.gpkgsaint_helena.gpkg
east_timor.gpkgsaint_kitts_and_nevis.gpkg
ecuador.gpkgsaint_lucia.gpkg
egypt.gpkgsaint_martin.gpkg
el_salvador.gpkgsaint_pierre_and_miquelon.gpkg
equatorial_guinea.gpkgsaint_vincent_and_the_grenadines.gpkg
eritrea.gpkgsamoa.gpkg
estonia.gpkgsan_marino.gpkg
eswatini.gpkgsão_tomé_and_principe.gpkg
ethiopia.gpkgsaudi_arabia.gpkg
falkland_islands.gpkgsenegal.gpkg
faroe_islands.gpkgseychelles.gpkg
federated_states_of_micronesia.gpkgsiachen_glacier.gpkg
fiji.gpkgsierra_leone.gpkg
finland.gpkgsingapore.gpkg
france.gpkgsint_maarten.gpkg
french_polynesia.gpkgslovakia.gpkg
french_southern_and_antarctic_lands.gpkgslovenia.gpkg
gabon.gpkgsolomon_islands.gpkg
gambia.gpkgsomalia.gpkg
georgia.gpkgsomaliland.gpkg
germany.gpkgsouth_africa.gpkg
ghana.gpkgsouth_georgia_and_the_islands.gpkg
greece.gpkgsouth_korea.gpkg
greenland.gpkgsouth_sudan.gpkg
grenada.gpkgspain.gpkg
guam.gpkgsri_lanka.gpkg
guatemala.gpkgsudan.gpkg
guernsey.gpkgsuriname.gpkg
guinea-bissau.gpkgsweden.gpkg
guinea.gpkgswitzerland.gpkg
guyana.gpkgsyria.gpkg
haiti.gpkgtaiwan.gpkg
heard_island_and_mcdonald_islands.gpkgtajikistan.gpkg
honduras.gpkgtanzania.gpkg
hong_kong_s.a.r..gpkgthailand.gpkg
hungary.gpkgthe_bahamas.gpkg
iceland.gpkgtogo.gpkg
india.gpkgtonga.gpkg
indian_ocean_territories.gpkgtrinidad_and_tobago.gpkg
indonesia.gpkgtunisia.gpkg
iran.gpkgturkey.gpkg
iraq.gpkgturkmenistan.gpkg
ireland.gpkgturks_and_caicos_islands.gpkg
isle_of_man.gpkguganda.gpkg
israel.gpkgukraine.gpkg
italy.gpkgunited_arab_emirates.gpkg
ivory_coast.gpkgunited_kingdom.gpkg
jamaica.gpkgunited_states_of_america.gpkg
japan.gpkgunited_states_virgin_islands.gpkg
jersey.gpkguruguay.gpkg
jordan.gpkguzbekistan.gpkg
kazakhstan.gpkgvanuatu.gpkg
kenya.gpkgvatican.gpkg
kiribati.gpkgvenezuela.gpkg
kosovo.gpkgvietnam.gpkg
kuwait.gpkgwallis_and_futuna.gpkg
kyrgyzstan.gpkgwestern_sahara.gpkg
laos.gpkgyemen.gpkg
latvia.gpkgzambia.gpkg
lebanon.gpkgzimbabwe.gpkg
lesotho.gpkg

Tag summary

Content type

Image

Digest

sha256:b30fc5b32…

Size

2.3 GB

Last updated

about 4 years ago

docker pull earthlab/firedpy