From a314a2e3c0b574f183e56b2037b082532f62e9dd Mon Sep 17 00:00:00 2001 From: faraway Date: Tue, 2 Aug 2022 11:10:23 +0200 Subject: [PATCH] Switched to noaa-20-viirs-c2 added additional layers --- VIIRSdownloader.py | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/VIIRSdownloader.py b/VIIRSdownloader.py index 29e7602..d889c16 100644 --- a/VIIRSdownloader.py +++ b/VIIRSdownloader.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """ 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. Description of data displayed: https://www.earthdata.nasa.gov/learn/find-data/near-real-time/firms/vnp14imgtdlnrt#ed-viirs-375m-attributes @@ -46,8 +46,12 @@ def get_address(data_frame, date): def render_map(in_ukraine, address_list, date): - src = ('https://gibs.earthdata.nasa.gov/wmts-webmerc/VIIRS_SNPP_CorrectedReflectance_BandsM11-I2-I1/' + - 'default/{time}/GoogleMapsCompatible_Level9/{z}/{y}/{x}.jpg') + 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') if not in_ukraine.empty: fire_map = folium.Map(location=in_ukraine[['latitude', 'longitude']].mean( ).to_list(), zoom_start=4, max_bounds=True, crs='EPSG3857') @@ -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], zoom_start=4, max_bounds=True, crs='EPSG3857') folium.raster_layers.TileLayer( - tiles=src, + tiles=src1, subdomains='abc', name='VIIRS CorrectedReflectance_BandsM11-I2-I1', 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)), tileSize=256, ).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) return fire_map @@ -91,7 +117,7 @@ def main(args): local_file = 'local_VIIRS_data-' + date + '.csv' if not os.path.exists(local_file): 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) try: with open(local_file, 'wb') as file: @@ -120,7 +146,11 @@ def main(args): 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( '-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')