Switched to noaa-20-viirs-c2

added additional layers
This commit is contained in:
faraway 2022-08-02 11:10:23 +02:00
parent f5afb9eb5f
commit a314a2e3c0

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" """
Downloads the actual active fire csv from Downloads the actual active fire csv from
https://firms.modaps.eosdis.nasa.gov/data/active_fire/suomi-npp-viirs-c2/csv/SUOMI_VIIRS_C2_Europe_24h.csv https://firms.modaps.eosdis.nasa.gov/data/active_fire/noaa-20-viirs-c2/csv/J1_VIIRS_C2_Europe_24h.csv
and displays it on a map. and displays it on a map.
Description of data displayed: Description of data displayed:
https://www.earthdata.nasa.gov/learn/find-data/near-real-time/firms/vnp14imgtdlnrt#ed-viirs-375m-attributes https://www.earthdata.nasa.gov/learn/find-data/near-real-time/firms/vnp14imgtdlnrt#ed-viirs-375m-attributes
@ -46,7 +46,11 @@ def get_address(data_frame, date):
def render_map(in_ukraine, address_list, date): def render_map(in_ukraine, address_list, date):
src = ('https://gibs.earthdata.nasa.gov/wmts-webmerc/VIIRS_SNPP_CorrectedReflectance_BandsM11-I2-I1/' + src1 = (r'https://gibs.earthdata.nasa.gov/wmts-webmerc/VIIRS_NOAA20_CorrectedReflectance_BandsM11-I2-I1/' +
'default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg')
src2 = (r'https://gibs.earthdata.nasa.gov/wmts-webmerc/VIIRS_NOAA20_CorrectedReflectance_TrueColor/' +
'default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg')
src3 = (r'https://gibs.earthdata.nasa.gov/wmts-webmerc/VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11/' +
'default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg') 'default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg')
if not in_ukraine.empty: if not in_ukraine.empty:
fire_map = folium.Map(location=in_ukraine[['latitude', 'longitude']].mean( fire_map = folium.Map(location=in_ukraine[['latitude', 'longitude']].mean(
@ -67,7 +71,7 @@ def render_map(in_ukraine, address_list, date):
fire_map = folium.Map(location=[(44.184598 + 52.3797464)/2, (22.137059 + 40.2275801)/2], fire_map = folium.Map(location=[(44.184598 + 52.3797464)/2, (22.137059 + 40.2275801)/2],
zoom_start=4, max_bounds=True, crs='EPSG3857') zoom_start=4, max_bounds=True, crs='EPSG3857')
folium.raster_layers.TileLayer( folium.raster_layers.TileLayer(
tiles=src, tiles=src1,
subdomains='abc', subdomains='abc',
name='VIIRS CorrectedReflectance_BandsM11-I2-I1', name='VIIRS CorrectedReflectance_BandsM11-I2-I1',
attr='NASA VIIRS', attr='NASA VIIRS',
@ -77,6 +81,28 @@ def render_map(in_ukraine, address_list, date):
time=str(dt.date.fromisoformat(date) - dt.timedelta(days=1)), time=str(dt.date.fromisoformat(date) - dt.timedelta(days=1)),
tileSize=256, tileSize=256,
).add_to(fire_map) ).add_to(fire_map)
folium.raster_layers.TileLayer(
tiles=src2,
subdomains='abc',
name='VIIRS_NOAA20_CorrectedReflectance_TrueColor',
attr='NASA VIIRS',
overlay=True,
layer='VIIRS_NOAA20_CorrectedReflectance_TrueColor',
tileMatrixSet='GoogleMapsCompatible_Level9',
time=str(dt.date.fromisoformat(date) - dt.timedelta(days=1)),
tileSize=256,
).add_to(fire_map)
folium.raster_layers.TileLayer(
tiles=src3,
subdomains='abc',
name='VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11',
attr='NASA VIIRS',
overlay=True,
layer='VIIRS_NOAA20_CorrectedReflectance_BandsM3-I3-M11',
tileMatrixSet='GoogleMapsCompatible_Level9',
time=str(dt.date.fromisoformat(date) - dt.timedelta(days=1)),
tileSize=256,
).add_to(fire_map)
folium.LayerControl().add_to(fire_map) folium.LayerControl().add_to(fire_map)
return fire_map return fire_map
@ -91,7 +117,7 @@ def main(args):
local_file = 'local_VIIRS_data-' + date + '.csv' local_file = 'local_VIIRS_data-' + date + '.csv'
if not os.path.exists(local_file): if not os.path.exists(local_file):
try: try:
remote_url = r'https://firms.modaps.eosdis.nasa.gov/data/active_fire/suomi-npp-viirs-c2/csv/SUOMI_VIIRS_C2_Europe_24h.csv' remote_url = r'https://firms.modaps.eosdis.nasa.gov/data/active_fire/noaa-20-viirs-c2/csv/J1_VIIRS_C2_Europe_24h.csv'
data = requests.get(remote_url, allow_redirects=True) data = requests.get(remote_url, allow_redirects=True)
try: try:
with open(local_file, 'wb') as file: with open(local_file, 'wb') as file:
@ -120,7 +146,11 @@ def main(args):
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(description=('Downloads the actual active fire csv from ' +
'https://firms.modaps.eosdis.nasa.gov/data/active_fire/noaa-20-viirs-c2/csv/J1_VIIRS_C2_Europe_24h.csv ' +
'and displays it on a map. ' +
'Description of data displayed: ' +
'https://www.earthdata.nasa.gov/learn/find-data/near-real-time/firms/vnp14imgtdlnrt#ed-viirs-375m-attributes'))
parser.add_argument( parser.add_argument(
'-i', '--inputfile', type=check_file_format, '-i', '--inputfile', type=check_file_format,
help='Specify the cvs file containing the satellite data to be displayed. INPUTFILE must match local_VIIRS_data-YYYY-MM-DD.csv') help='Specify the cvs file containing the satellite data to be displayed. INPUTFILE must match local_VIIRS_data-YYYY-MM-DD.csv')