Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,12 @@

# Miscellaneous
/setup2.py
/proj/
/proj/

# Ignore outputs folder
output/*

# Ignore PyCharm files
*.idea
app.log
temp_test.gpkg
17 changes: 13 additions & 4 deletions bin/firedpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ def str_to_bool(s: str):
def test_earthdata_credentials(username: str, password: str) -> None:
# Earthdata Login
# test url for correct user/password
url = "https://e4ftl01.cr.usgs.gov/MOTA/MCD12Q1.061/2019.01.01/BROWSE.MCD12Q1.A2019001.h10v09.061.2022169160720.1.jpg"
# base URL for the MCD12Q1 (landcover) product
base_url = 'https://data.lpdaac.earthdatacloud.nasa.gov/lp-prod-public/MCD12Q1.061/'
# granule-specific URL for testing
granule_url = 'MCD12Q1.A2019001.h10v09.061.2022169160720/BROWSE.MCD12Q1.A2019001.h10v09.061.2022169160720.1.jpg'
url = base_url + granule_url

password_manager = urllib.request.HTTPPasswordMgrWithDefaultRealm()
password_manager.add_password(None, "https://urs.earthdata.nasa.gov", username, password)
Expand Down Expand Up @@ -204,13 +208,15 @@ def main():
end_year = None if end_year == 0 else end_year

if land_cover_type != LandCoverType.NONE:
print('Retrieving landcover...')
print('\nRetrieving landcover data ...')
land_cover = LandCover(out_dir, n_cores=n_cores, username=username, password=password)
land_cover.get_land_cover(tiles, land_cover_type)

eco_region_data = EcoRegion(out_dir)
eco_region_data.get_eco_region()

print('\nRetrieving burn data ...')
test_earthdata_credentials(username, password) # test this again to be sure
burn_data = BurnData(out_dir, username, password, n_cores)
burn_data.get_burns(tiles, start_year, end_year)

Expand All @@ -222,13 +228,16 @@ def main():

# TODO: This can be parallelized
gdf = models.build_points(event_perimeters, shape_file_path=shape_file)
# add in the fire attributes
gdf = models.add_fire_attributes(gdf)
# add in the ecoregion information:
gdf = models.add_eco_region_attributes(gdf, eco_region_type, eco_region_level)
# add in the landcover
if land_cover_type != LandCoverType.NONE:
gdf = models.add_land_cover_attributes(gdf, land_cover_type)
gdf = models.process_geometry(gdf)

gdf.to_file('temp_test.gpkg', driver="GPKG")
gdf = models.add_eco_region_attributes(gdf, eco_region_type, eco_region_level)
# gdf.to_file('temp_test.gpkg', driver="GPKG") # testing

def generate_path(proj_dir, base_filename, shape_type: ShapeType):
"""Generate the appropriate file path."""
Expand Down
12 changes: 6 additions & 6 deletions data/params.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
out_dir,Where would you like the output for this run saved?,str,output,none
full_csv,Enter (true y yes) if you want a full csv. Enter (false n no) if you want a raw csv,bool,True,true|yes|y|false|no|n
tile_choice,"Would you like the fired product on a) continent b) country c) US state or d) specific MODIS tiles?",str,b,a|b|c|d
tile_name,f,str,conus_ak,none
eco_region_type,Please enter the eco_region type,str,world,world|na
daily,Enter (true y yes) if you want to create the daily polygons or (false n no) for just the event-level perimeter for your analysis area,bool,True,true|yes|y|false|no|n
tile_choice,"Would you like the fired product on a) continent b) country c) US state or d) specific MODIS tiles?",str,d,a|b|c|d
tile_name,f,str,h09v05,none
eco_region_type,Please enter the eco_region type,str,na,world|na
daily,Enter (true y yes) if you want to create the daily polygons or (false n no) for just the event-level perimeter for your analysis area,bool,False,true|yes|y|false|no|n
spatial,fPlease enter the number of cells (~463 m resolution) to search for neighboring burn detections in all directions,int,5,none
temporal,The number of days between events to search for neighboring burn detections,int,11,none
shape_type,Specify the format of the shapefile you want. Can be 'shp' 'gpkg' or 'both'.,str,both,gpkg|shp|both|none
shape_type,Specify the format of the shapefile you want. Can be 'shp' 'gpkg' or 'both'.,str,gpkg,gpkg|shp|both|none
land_cover_type,If you would like to include land cover as an attribute enter the land cover type number you would like to use.\nAvailable land cover categories: \n 0: None \n 1: IGBP global vegetation classification scheme \n 2: University of Maryland (UMD) scheme \n 3: MODIS-derived LAI/fPAR scheme \n 4: MODIS-derived Net Primary Production (NPP) scheme \n 5: Plant Functional Types (PFT) scheme \n,int,1,0|1|2|3|4|5
username,Enter your NASA Earthdata username,str,erve3705,none
username,Enter your NASA Earthdata username,str,maco4303,none
password,Enter your NASA Earthdata password,str,,none
start_year,Enter the year you want to start or 0 for all dates,int,0,none
end_year,Enter the year you want to end or 0 for all dates,int,0,none
Expand Down
Loading