AmeriGEO Week 2019

AMERIGEO.jpg

united_states_of_america_round_icon_640

We are pleased to invite you to the following training event:

New Generation Geostationary (GOES-16/17) and Polar Orbiting (JPSS – Suomi NPP and NOAA-20) Satellite Imagery and Products to meet GEO priority areas.

Date: August 21 – 23, 2019

Location: National Meteorology and Hydrology Service of Peru (SENAMHI), Jr. Cahuide 785, Jesús María, Lima, Peru

Level: Advanced – with the opportunity to tailor to specific area needs

Length: 9:00 AM – 5:00 PM Wednesday (August 21) & Thursday (August 22) 9:00 AM – 1:00 PM Friday (August 23)

Registration: http://bit.ly/Satellite-19

There is no registration fee for this course. Please note that there will not be any breaks/lunch provided during the workshop. Spaces are limited.

Contacts:  Martin Medina ([email protected]), José Galvez ([email protected]), Bernadette Connell ([email protected]), Natalia Donoho ([email protected]), and Diego Souza ([email protected])

Description: The satellite workshop will focus on both GOES-R Series and JPSS satellite capabilities, data access and applications to support the region. It will be a hands-on workshop conducted in Spanish, and consisting of 3 components: 1) Overview of imagery and products available, 2) Access to data via direct broadcast, internet, and archive with a particular emphasis on GEONETCast Americas (GNC-A) supported by GEO, and 3) Case study examples highlighting the usages of the imagery and products.  The GNC-A component will include a tour to the station located in Servicio Nacional de Meteorología and Hidrología (SENAMHI).

On the case study example component, participants will have the opportunity to submit a case study* from their respective office/region that was particularly challenging. Submitted cases will be considered for presentation during the workshop and subject matter experts will be able to present their analysis of the case study and provide suggestions on satellite data or products that could be of value to improve forecast/preparedness for future events. Topics may include the following: severe weather (excessive rainfall or drought), volcanic eruptions, fires, smoke, lightning, and vegetation indices.

There will be time for open discussion to gather feedback and input on satellite usage at the end of the workshop. Answers to the following questions will help to better tailor these workshops in the future: Is the product information useful? Is there more specific information that is desired? Is the information being communicated to the user in a manner that is understandable? Other questions?

By the end of the course, participants should have acquired working knowledge of:
The GOES-R Series key instruments – Advanced Baseline Imager (ABI) and Geostationary Lightning Mapper (GLM),
The JPSS key instruments – VIIRS, CrIS, and ATMS,
The most relevant satellite channels and products from JPSS and GOES-East ABI,
The various methods to access GOES and JPSS/GCOM data and products including the global GEONETCast and GEONETCast Americas systems (GNC-A),
Resources for the maintenance and troubleshooting of common issues related to a GNC-A station.

*If a participant would like to submit a case study or an area of focus, please send a brief summary to the contacts listed.

Additional Information for AmeriGEO Week 2019: https://www.amerigeoss.org/amerigeoss-events/amerigeoss-week-2019

spain_640

Taller sobre los nuevos Satélites Geoestacionarios (GOES-16/17) y Polares (JPSS, Suomi NPP y NOAA-20) de NOAA: Cómo sus Imágenes y Productos Satisfacen las Áreas Prioritarias de GEO

21-23 de Agosto, 2019

Servicio Nacional de Meteorología e Hidrología del Perú (SENAMHI)
Jr. Cahuide 785, Jesús María, Lima, Perú

Dirigido a: Usuarios avanzados. Tendremos la posibilidad de adaptarlo a las prioridades y necesidades de los participantes

Duración: 18 horas (7 el miércoles, 7 el jueves y 4 el viernes)
Horario: de 9:00 a 17;00 miércoles y jueves y de 9: a 13:00 viernes

Inscripción: La participación en este taller es gratuita. Sin embargo, existe un número limitado para participantes. Se puede inscribir en este taller aquí: http://bit.ly/Satellite-19. Por favor note que la comida y café no
están incluidas y cada participante deberá cubrirlas con sus propios fondos.

Personas de Contacto:  Martin Medina ([email protected]), José Galvez ([email protected]), Bernadette Connell ([email protected]), Natalia Donoho ([email protected]), y Diego Souza ([email protected])

Descripción del Taller: El taller se enfocará en las capacidades, sensores, formas de acceso a los datos y aplicaciones de los satélites GOES-R y JPSS. Será un taller teórico-práctico con varios ejercicios y únicamente en idioma español. No habrá traducción simultánea a otros idiomas. El taller tendrá los siguientes componentes: 1) Discusión general de las imágenes y productos que están disponibles al público; 2) Formas de acceso a los datos satelitales: recepción directa con antena propia, por Internet, por medio del sistema GEONETCast Américas (GNC-A) apoyado por GEO, así como el uso de archivos de datos; 3) Discusión de estudios de caso que ilustren el uso de imágenes satelitales. El componente de GNC-A incluirá una visita de campo al Servicio Nacional de Meteorología e Hidrología del Perú (SENAMHI) que cuenta con una antena receptora de este sistema. Para los estudios de caso los participantes podrán proponer sus propios casos a analizar.* Los casos propuestos por los participantes podrán ser analizados por expertos de NOAA durante el taller. Los expertos también ofrecerán recomendaciones sobre datos o productos que podrían mejorar sus pronósticos en el futuro. Casos de estudio sobre los siguientes temas serían especialmente bienvenidos: mal tiempo, alta precipitación, sequía, erupciones volcánicas, incendios forestales, humo, rayos e índices de vegetación.

Al final del taller tendremos una sesión para que los participantes se expresen libremente sobre el uso de imágenes satelitales. Nos gustaría que los participantes nos indicaran lo siguiente: i) Fue útil la información incluida en el taller? Necesita otro tipo de información? Mayores detalles? Fue la forma de presentación fácil de comprender para los participantes? Otras preguntas? Sus repuestas a estas preguntas nos serán muy útiles para poder mejorar estos talleres en el futuro.

Al final del taller, los participantes tendrán conocimiento de lo siguiente:
1.    Los sensores mas importantes de los satélites GOES: ABI (Advanced Baseline Imager) y GLM (Geostationary Lightning Mapper)
2.    Los sensores más importantes de los satélites JPSS: CrIS, y ATMS
3.    Losa productos y bandas más importantes de los satélites JPSS y el ABI del GOES Este
4.    Las diferentes formas de acceso de datos de los satélites GOES y JPSS/GCOM, incluyendo el sistema GEONETCast Américas
5.    Recursos disponibles para el mantenimiento y problemas frecuentes en la instalación y operación de estaciones receptoras del sistema GEONETCast Américas

brazil_640

Workshop sobre os novos satélites geoestacionários (GOES-16/17) e Polar (JPSS, Suomi NPP e NOAA-20) da NOAA: como suas imagens e produtos atendem as áreas prioritárias do GEO

21 a 23 de agosto de 2019

Serviço Nacional de Meteorologia e Hidrologia do Peru (SENAMHI)
Jr. Cahuide 785, Jesús María, Lima, Peru

Destinado a: Usuários avançados. Teremos a possibilidade de adaptá-lo às prioridades e necessidades dos participantes

Duração: 18 horas (7 na quarta-feira, 7 na quinta e 4 na sexta-feira)
Horário: das 9:00 às 17:00, às quartas e quintas-feiras, e das 9:00 às 13:00, às sextas-feiras.

Inscrição: A participação neste workshop é gratuita. No entanto, existe um número limitado de participantes. Você pode se inscrever para este workshop aqui: http://bit.ly/tellite-19. Por favor, note que a comida e o café não Eles estão incluídos e cada participante deve cobri-los com seus próprios recursos.

Pessoas para contato: Martin Medina ([email protected]), José Galvez (José[email protected]), Bernadette Connell ([email protected]), Natalia Donoho ([email protected]) ) e Diego Souza ([email protected])

Descrição do Workshop: O workshop se concentrará nas capacidades, sensores, formas de acesso a dados e aplicações dos satélites GOES-R e JPSS. Será uma oficina teórica e prática com vários exercícios e somente em espanhol. Não haverá tradução simultânea para outros idiomas. O workshop terá os seguintes componentes: 1) Discussão geral das imagens e produtos que estão disponíveis ao público; 2) Formas de acesso a dados de satélite: recepção direta com sua própria antena, através da Internet, através do sistema GEONETCast Americas (GNC-A) suportado pelo GEO, bem como o uso de arquivos de dados; 3) Discussão de estudos de caso que ilustram o uso de imagens de satélite. O componente GNC-A incluirá uma visita de campo ao Serviço Nacional de Meteorologia e Hidrologia do Peru (SENAMHI), que possui uma antena receptora para este sistema. Para os estudos de caso, os participantes podem propor seus próprios casos para análise. * Os casos propostos pelos participantes podem ser analisados ​​por especialistas da NOAA durante o workshop. Os especialistas também oferecerão recomendações sobre dados ou produtos que possam melhorar suas previsões no futuro. Estudos de caso sobre os seguintes tópicos seriam especialmente bem-vindos: mau tempo, alta precipitação, seca, erupções vulcânicas, incêndios florestais, fumaça, raios e índices de vegetação.

No final do workshop, teremos uma sessão para os participantes se expressarem livremente sobre o uso de imagens de satélite. Gostaríamos que os participantes indicassem o seguinte: i) As informações incluídas no workshop foram úteis? Você precisa de outras informações? Mais detalhes? A forma de apresentação foi fácil de entender para os participantes? Outras perguntas? Suas respostas a essas perguntas serão muito úteis para melhorar esses workshops no futuro.

No final do workshop, os participantes estarão capacitados sobre:
1. Os sensores mais importantes dos satélites GOES: ABI (Advanced Baseline Imager) e GLM (Geostationary Lightning Mapper)
2. Os sensores mais importantes dos satélites JPSS: CrIS e ATMS
3. Os produtos e bandas mais importantes dos satélites JPSS e o ABI do GOES-16
4. As diferentes formas de acesso a dados dos satélites GOES e JPSS / GCOM, incluindo o sistema GEONETCast Americas
5. Recursos disponíveis para manutenção e problemas freqüentes na instalação e operação de estações receptoras do sistema GEONETCast Americas

AMERIGEO2.jpg

Python + Satellite Imagery Quickstart

Python_Quickstart_Banner.jpg

GOES-16 plot made with Python – Let’s see how to do it!

Quickstart With Python and Satellite Imagery

Contact: If you have any questions, please contact: Learning Objectives: By the end of this training, attendees will:
  • Become familiar with some basic tools to start manipulating satellite images with Python
  • Understand how to make basic operations like:
    • Reading a GOES-R (GOES-16 or 17) NetCDF files
    • Making a basic GOES-R plot and visualize pixel values (brightness temperatures / reflectances)
    • Change color scales, add a title and a colorbar to the plot
    • Add coastlines, countries, states / provinces (and other shapefiles)
    • Create a Full Resolution Plot
    • Create an RGB Composite
Duration: 1:20 h, including installation

Prerequisites:

For this exercise, we’ll need the following:
  • Python 3.7 (our programming language)
  • A “Package Manager” (to install libraries)
  • An “Environment Manager” (to separate our projects)
  • A Text Editor (to write our code)
  • GOES-R imagery samples (the data to be manipulated)

For the first three items (“Python 3.7”, “Package Manager” and “Environment Manager”), the “Miniconda” tool will be sufficient.

As for the text editor, there are many options available (Spyder, PyCharm, Atom, Jupyter, etc), but for simplicity, today we’ll use “Notepad++”:

For the GOES-R imagery samples, we’ll download them from the cloud (Amazon). You may also get these from your GNC-A station or other receive mechanisms (GRB, etc).

Installation steps:

1 ) Download and install Miniconda for Python 3.7 at the following link (60 MB only):

https://docs.conda.io/en/latest/miniconda.html

Python_Quickstart_Conda.jpg

Notes:

  • During the installation, it is not necessary to check “Add Anaconda to my Path environment variable”.
  • You may check “Register Anaconda as my default Python 3.7”
  • The installation will take approximately 5 minutes.

Creating a Python virtual environment and installing libraries:

2 ) Let’s create a Python environment called workshop and install the following libraries and their dependencies in this environment:

  • matplotlib: plotting library
  • netcdf4: read / write NetCDF files
  • cartopy: produce maps and other geospatial data analyses
In order to do it, open the recently installed “Anaconda Prompt” as an Admin: Executing Anaconda Prompt And insert the following command:
conda create --name workshop -c conda-forge matplotlib netcdf4 cartopy
Where:

workshop: The name of your environment. It could be anything, like “satellite”, “goes”, etc…

matplotlib netcdf4 cartopy: The libraries we wan’t to install Notes: 
  • During the installation, type “y” and Enter  to proceed, when requested.
  • This procedure should take approximately 10 minutes.
install_libs_1b install_libs_1c.jpg Finally, activate the newly created virtual environment with the following command:

activate workshop

activate_workshop Note: If you are using Linux, use “source activate workshop A plus: Although the commands below are not required for these exercises, they are nice to know for your future development:
  • Deactivate an environment: conda deactivate
  • Viewing list of environments: conda env list
  • Viewing a list of packages (libraries, etc) installed in an environment: conda list
More information on managing environments may be found at this link.

We are ready to start using Python, however, we need an editor to write our code and also, we need some sample GOES-R imagery.

Downloading an editor:

3 ) Download and install Notepad++ at the following link (4 MB only):

https://notepad-plus-plus.org/download

Python_Quickstart_Notepad.jpg Note:
  • If the link above fails, you may download the installer (64 bit) at this link.
  • You may use any editor you want (e.g.: Windows Notepad), as long as you save the file with the “.py” extension.

Downloading GOES-R NetCDF samples:

4 ) Create a folder called VLAB\Python\ in your machine ( e.g.: C:\VLAB\Python\ )

5 ) Access the following page:

http://home.chpc.utah.edu/~u0553130/Brian_Blaylock/cgi-bin/goes16_download.cgi

Choose the following options:

  • Satellite: Either GOES-16/East or GOES-17/West
  • Domain: Full Disk
  • Product: ABI L2 Cloud and Moisture Imagery
  • Date and Hour (UTC): Any date and hour you want!

Click on “Submit” and then download a file for Band 13, by clicking at the blue boxes with the minutes for that hour (pick any time you want).

Note: For the printscreens on this page, we’ve downloaded files for JULY 17, 2019, 12:00 UTC. GOES-Download.jpg

The NetCDF will be downloaded.

Put the NetCDF at the folder you just created ( e.g.: C:\VLAB\Python\ )

We are ready to begin!

PRACTICE 1: FIRST PLOT AND GETTING PIXEL VALUES

6 ) Open your text editor / IDE (in our example, “Notepad++”), insert the code below, and save it as “Script_01.py”, inside the C:\VLAB\Python\ folder (the same directory you have your NetCDF sample):

Important: Insert the name of the file you just downloaded in the instruction from line 8:

 




# Training: Python and GOES-R Imagery: Script 1

# Required modules
from netCDF4 import Dataset      # Read / Write NetCDF4 files
import matplotlib.pyplot as plt  # Plotting library

# Open the GOES-R image
file = Dataset("OR_ABI-L2-CMIPF-M6C13_G16_s20191981200396_e20191981210116_c20191981210189.nc")

# Get the pixel values
data = file.variables['CMI'][:]

# Choose the plot size (width x height, in inches)
plt.figure(figsize=(7,7))

# Plot the image
plt.imshow(data, vmin=193, vmax=313, cmap='Greys')

# Save the image
plt.savefig('Image_01.png')
# Show the image
plt.show()

YOU MAY DOWNLOAD THE SCRIP ABOVE (Script_01.py) AT THIS LINK

The image below shows the script opened in Notepad++: script_1.jpg

In the Anaconda prompt, with the “workshop” environment activated, access the C:\VLAB\Python\ directory:

cd C:\VLAB\Python

Execute the script “Script_01.py” using the following command:

python Script_01.py

activate_workshop_2.jpg A window will pop-up and you should see your first GOES-R plot made with Python: Python_Quickstart_Plot1.jpg
  • Seeing the Brightness Temperatures

Move the mouse pointer over the plot, and you will see the Band 13 pixel values in Brightness Temperatures (K) in the lower left part of the screen. In the example image below, this particular cloud top temperature is 227 K:

Python_Quickstart_Plot1b.jpg
  • Zoom on a given region

In order to zoom on a given region, just click on the magnifier icon in the upper part of the screen and select the region you want to zoom in.

Python_Quickstart_Plot1c.jpg To go back to the full view, click at the “Home” icon. Apart from the visualization screen, a PNG image called ‘Image_01.png’ has been saved to your working directory (C:\VLAB\Python\). bulb-iconWhat can you quickly change in this script?
  • The image to be read. Try downloading other images from Amazon (other time, dates and bands) and plot it.
  • The final image size. Try generating images with other dimensions.
  • The minimum and maximum vales. Try changing the min and max Kelvin values to see different contrasts.

PRACTICE 2: CONVERT TO CELSIUS, ADD A COLORBAR AND A TITLE

Let’s create our second script. Save a file called “Script_02.py”. In order to convert the pixels to Celsius, just add the following subtraction to line 11:
# Get the pixel values
data = file.variables['CMI'][:] - 273.15
By doing this, we have to change the minimum and maximum values of our colormap, from 193 ~ 313 K to -80 ~ 40 °C:
# Plot the image
plt.imshow(data, vmin=-80, vmax=40, cmap='Greys')
In order to add a colorbar, just add the following line to the script:
# Add a colorbar
plt.colorbar(label='Brightness Temperatures (°C)', extend='both', orientation='horizontal', pad=0.05, fraction=0.05)
In order to add a Title, add the following lines to the script:
# Putting a title
plt.title('GOES-16 Band 13', fontweight='bold', fontsize=10, loc='left')
plt.title('Full Disk', fontsize=10, loc='right')
This should be your full script by now:
# Training: Python and GOES-R Imagery: Script 2

# Required modules
from netCDF4 import Dataset      # Read / Write NetCDF4 files
import matplotlib.pyplot as plt  # Plotting library

# Open the GOES-R image
file = Dataset("OR_ABI-L2-CMIPF-M6C13_G16_s20191981200396_e20191981210116_c20191981210189.nc")

# Get the pixel values
data = file.variables['CMI'][:] - 273.15

# Choose the plot size (width x height, in inches)
plt.figure(figsize=(7,7))

# Plot the image
plt.imshow(data, vmin=-80, vmax=40, cmap='Greys')

# Add a colorbar
plt.colorbar(label='Brightness Temperature (°C)', extend='both', orientation='horizontal', pad=0.05, fraction=0.05)

# Add a title
plt.title('GOES-16 Band 13', fontweight='bold', fontsize=10, loc='left')
plt.title('Full Disk', fontsize=10, loc='right')

# Save the image
plt.savefig('Image_02.png')

# Show the image
plt.show()

YOU MAY DOWNLOAD THE SCRIP ABOVE (Script_02.py) AT THIS LINK

Execute the script “Script_02.py” using the following command:

python Script_02.py

You should see the following plot: Python_Quickstart_Plot2
  • Changing the colormap (cmap)

Now, in line 17, change the cmap from ‘Greys’ to ‘jet’.

# Plot the image
plt.imshow(data, vmin=-80, vmax=40, cmap='jet')

Python_Quickstart_Plot2b.jpg

Please find at the following link, the colormaps that are available by default:

https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html

Apart from the visualization screen, a PNG image called ‘Image_02.png’ has been saved to your working directory (C:\VLAB\Python\). bulb-iconWhat can you quickly change in this script?
  • The colormap. Try making plots with diferent colormaps form the webpage above.
  • The title of the image. Try changing the size of the text.
  • The colorbar appearance. Try changing the orientation to “vertical” and the colorbar size changing the “fraction” value

PRACTICE 3: ADDING MAPS WITH CARTOPY

Let’s create our third script. Save a file called “Script_03.py”. In order to use cartopy in our plot, this is the script we’ll use:
# Training: Python and GOES-R Imagery: Script 3

# Required modules
from netCDF4 import Dataset          # Read / Write NetCDF4 files
import matplotlib.pyplot as plt      # Plotting library
import cartopy, cartopy.crs as ccrs  # Plot maps

# Open the GOES-R image
file = Dataset("OR_ABI-L2-CMIPF-M6C13_G16_s20191981200396_e20191981210116_c20191981210189.nc")

# Get the pixel values
data = file.variables['CMI'][:] - 273.15

# Choose the plot size (width x height, in inches)
plt.figure(figsize=(7,7))

# Use the Geostationary projection in cartopy
ax = plt.axes(projection=ccrs.Geostationary(central_longitude=-75.0, satellite_height=35786023.0))
img_extent = (-5434894.67527,5434894.67527,-5434894.67527,5434894.67527)

# Add coastlines, borders and gridlines
ax.coastlines(resolution='10m', color='white', linewidth=0.8)
ax.add_feature(cartopy.feature.BORDERS, edgecolor='white', linewidth=0.5)
ax.gridlines(color='white', alpha=0.5, linestyle='--', linewidth=0.5)

# Plot the image
img = ax.imshow(data, vmin=-80, vmax=40, origin='upper', extent=img_extent, cmap='Greys')

# Add a colorbar
plt.colorbar(img, label='Brightness Temperatures (°C)', extend='both', orientation='horizontal', pad=0.05, fraction=0.05)

# Add a title
plt.title('GOES-16 Band 13', fontweight='bold', fontsize=10, loc='left')
plt.title('Full Disk', fontsize=10, loc='right')

# Save the image
plt.savefig('Image_03.png')

# Show the image
plt.show()

YOU MAY DOWNLOAD THE SCRIP ABOVE (Script_03.py) AT THIS LINK

Execute the script “Script_03.py” using the following command:

python Script_03.py

You should see the following plot:

Python_Quickstart_Plot3.jpg

  • Seeing the Latitudes, Longitudes and Brightness Temperatures

Move the mouse pointer over the plot, and apart from the Band 13 pixel values in Brightness Temperatures (°C), you will see the pixel coordinates:

Python_Quickstart_Plot3b.jpg Apart from the visualization screen, a PNG image called ‘Image_03.png’ has been saved to your working directory (C:\VLAB\Python\). bulb-iconWhat can you quickly change in this script?
  • The map colors and line widths. Please find at this link, a list of named colors.

PRACTICE 4: ADD SHAPEFILES

Let’s create our fourth script. Save a file called “Script_04.py”.

Please download a sample shapefile, with the world states and provinces at this link. Extract it (unzip) in your C:\VLAB\Python\ directory, where you have your scripts and sample imagery.

This is what you should have in your directory by now: Files_ex_4 In order to add a shapefile, we need to import the Cartopy “shapereader”:
import cartopy.io.shapereader as shpreader # Import shapefiles
And add the shapefile to the visualization with the following commands:
# Add a shapefile
shapefile = list(shpreader.Reader('ne_10m_admin_1_states_provinces.shp').geometries())
ax.add_geometries(shapefile, ccrs.PlateCarree(), edgecolor='gold',facecolor='none', linewidth=0.3)
This should be your full script by now:
# Training: Python and GOES-R Imagery: Script 4

# Required modules
from netCDF4 import Dataset                # Read / Write NetCDF4 files
import matplotlib.pyplot as plt            # Plotting library
import cartopy, cartopy.crs as ccrs        # Plot maps
import cartopy.io.shapereader as shpreader # Import shapefiles

# Open the GOES-R image
file = Dataset("OR_ABI-L2-CMIPF-M6C13_G16_s20191981200396_e20191981210116_c20191981210189.nc")

# Get the pixel values, and convert to Celsius
data = file.variables['CMI'][:] - 273.15

# Choose the plot size (width x height, in inches)
plt.figure(figsize=(7,7))

# Use the Geostationary projection in cartopy
ax = plt.axes(projection=ccrs.Geostationary(central_longitude=-75.0, satellite_height=35786023.0))
img_extent = (-5434894.67527,5434894.67527,-5434894.67527,5434894.67527)

# Add a shapefile
shapefile = list(shpreader.Reader('ne_10m_admin_1_states_provinces.shp').geometries())
ax.add_geometries(shapefile, ccrs.PlateCarree(), edgecolor='gold',facecolor='none', linewidth=0.3)

# Add coastlines, borders and gridlines
ax.coastlines(resolution='10m', color='white', linewidth=0.8)
ax.add_feature(cartopy.feature.BORDERS, edgecolor='white', linewidth=0.8)
ax.gridlines(color='white', alpha=0.5, linestyle='--', linewidth=0.5)

# Plot the image
img = ax.imshow(data, vmin=-80, vmax=40, origin='upper', extent=img_extent, cmap='Greys')

# Add a colorbar
plt.colorbar(img, label='Brightness Temperature (°C)', extend='both', orientation='horizontal', pad=0.05, fraction=0.05)

# Add a title
plt.title('GOES-16 Band 13', fontweight='bold', fontsize=10, loc='left')
plt.title('Full Disk', fontsize=10, loc='right')

# Save the image
plt.tight_layout()
plt.savefig('Image_04.png')

# Show the image
plt.show()

YOU MAY DOWNLOAD THE SCRIP ABOVE (Script_04.py) AT THIS LINK

Execute the script “Script_04.py” using the following command:

python Script_04.py

Important: This particular shapefile has a considerable size. The plot may take a while to complete. You should see the following plot: Python_Quickstart_Plot4.jpg

Apart from the visualization screen, a PNG image called ‘Image_04.png’ has been saved to your working directory (C:\VLAB\Python\).

bulb-iconWhat can you quickly change in this script?
  • The shapefile to be read. Try adding other shapefiles of your preference (e.g.: rivers)

PRACTICE 5: FULL RESOLUTION PNG PLOT

Let’s create our fifth script. Save a file called “Script_05.py”. For now, we have been defining the size of our image, in inches, as below:
# Choose the plot size (width x height, in inches)
plt.figure(figsize=(7,7))
In order to create a full resolution PNG image, let’s change this line to the following:
# Add a shapefile
shapefile = list(shpreader.Reader('ne_10m_admin_1_states_provinces.shp').geometries())
ax.add_geometries(shapefile, ccrs.PlateCarree(), edgecolor='gold',facecolor='none', linewidth=0.3)
And add the following before saving our plot to PNG:
# Save the image
plt.tight_layout()
plt.savefig('Image_05.png')
Also, we will comment the colorbar instruction in this particular exercise:
# Add a colorbar
#plt.colorbar(img, label='Brightness Temperature (°C)', extend='both', orientation='horizontal', pad=0.05, fraction=0.05)
And also comment the plt.show instruction, for we just want to create the PNG:
# Show the image
#plt.show()
This should be your full script by now:
# Training: Python and GOES-R Imagery: Script 5

# Required modules
from netCDF4 import Dataset                # Read / Write NetCDF4 files
import matplotlib.pyplot as plt            # Plotting library
import cartopy, cartopy.crs as ccrs        # Plot maps
import cartopy.io.shapereader as shpreader # Import shapefiles

# Open the GOES-R image
file = Dataset("OR_ABI-L2-CMIPF-M6C13_G16_s20191981200396_e20191981210116_c20191981210189.nc")

# Get the pixel values, and convert to Celsius
data = file.variables['CMI'][:] - 273.15

# Choose the plot size (width x height, in inches)
# Choose the final image size (inches)
dpi = 150
plt.figure(figsize=(data.shape[1]/float(dpi), data.shape[0]/float(dpi)), dpi=dpi)

# Use the Geostationary projection in cartopy
ax = plt.axes(projection=ccrs.Geostationary(central_longitude=-75.0, satellite_height=35786023.0))
img_extent = (-5434894.67527,5434894.67527,-5434894.67527,5434894.67527)

# Add a shapefile
shapefile = list(shpreader.Reader('ne_10m_admin_1_states_provinces.shp').geometries())
ax.add_geometries(shapefile, ccrs.PlateCarree(), edgecolor='gold',facecolor='none', linewidth=0.3)

# Add coastlines, borders and gridlines
ax.coastlines(resolution='10m', color='white', linewidth=0.8)
ax.add_feature(cartopy.feature.BORDERS, edgecolor='red', linewidth=0.8)
ax.gridlines(color='white', alpha=0.5, linestyle='--', linewidth=0.5)

# Plot the image
img = ax.imshow(data, vmin=-80, vmax=40, origin='upper', extent=img_extent, cmap='Greys')

# Add a colorbar
#plt.colorbar(img, label='Brightness Temperature (°C)', extend='both', orientation='horizontal', pad=0.05, fraction=0.05)

# Add a title
plt.title('GOES-16 Band 13', fontweight='bold', fontsize=10, loc='left')
plt.title('Full Disk', fontsize=10, loc='right')

# Save the image
plt.tight_layout()
plt.savefig('Image_05.png')

# Show the image
#plt.show()

YOU MAY DOWNLOAD THE SCRIP ABOVE (Script_05.py) AT THIS LINK

Execute the script “Script_05.py” using the following command:

python Script_05.py

After the script execution, you should have the following full resolution PNG: Python_Quickstart_Plot5.jpg Zooming in an specific region: Python_Quickstart_Plot5b.jpg

PRACTICE 6: CREATING AN RGB (RED, GREEN, BLUE) COMPOSITE

Let’s create the Airmass RGB Composite with Python. Consider the Airmass recipe found on the RAMMB Quick Guide:

ARM_Quick_Guide

http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_AirMassRGB_final.pdf

This is the recipe: Airmass_Recipe.jpg Step 1) First of all, according to the recipe, we need to read four GOES-R Bands:
  • Band 08 (6.2 um)
  • Band 10 (7.3 um)
  • Band 12 (9.6 um)
  • Band 13 (10.3 um)

Access the Amazon Download Web Page from the beggining of this tutorial, and download NetCDF’s for the same time and date for these 4 channels.

http://home.chpc.utah.edu/~u0553130/Brian_Blaylock/cgi-bin/goes16_download.cgi

This is what you should have by now: Files_ex_6 We already know how to read GOES-R files, right?
# Open the GOES-R image
file1 = Dataset("OR_ABI-L2-CMIPF-M6C08_G16_s20191981200396_e20191981210104_c20191981210182.nc")
# Get the pixel values, and convert to Celsius
data1 = file1.variables['CMI'][:] - 273.15
#print(data1)

# Open the GOES-R image
file2 = Dataset("OR_ABI-L2-CMIPF-M6C10_G16_s20191981200396_e20191981210116_c20191981210188.nc")
# Get the pixel values, and convert to Celsius
data2 = file2.variables['CMI'][:] - 273.15

# Open the GOES-R image
file3 = Dataset("OR_ABI-L2-CMIPF-M6C12_G16_s20191981200396_e20191981210111_c20191981210185.nc")
# Get the pixel values, and convert to Celsius
data3 = file3.variables['CMI'][:] - 273.15

# Open the GOES-R image
file4 = Dataset("OR_ABI-L2-CMIPF-M6C13_G16_s20191981200396_e20191981210116_c20191981210189.nc")
# Get the pixel values, and convert to Celsius
data4 = file4.variables['CMI'][:] - 273.15
Step 2) Then, we need to perform the operations seen on the recipe (middle column):
# RGB Components
R = data1 - data2
G = data3 - data4
B = data1
Step 3) And we need to set the minimuns, maximuns and gamma values, according to the recipe:
# Minimuns, Maximuns and Gamma
Rmin = -26.2
Rmax = 0.6

Gmin = -43.2
Gmax = 6.7

Bmin = -29.25
Bmax = -64.65
R[R>Rmax] = Rmax R[R<Rmin] = Rmin G[G>Gmax] = Gmax G[G<Gmin] = Gmin B[B<Bmax] = Bmax B[B>Bmin] = Bmin
gamma_R = 1
gamma_G = 1
gamma_B = 1
Step 4) Let’s normalize the data beween 0 and 1:
# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)
Step 5) Finally, we stack the R, G and B components to create the final composite:
# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# Eliminate values outside the globe
mask = (RGB == [R[0,0],G[0,0],B[0,0]]).all(axis=2)
RGB[mask] = np.nan
Step 6) And plot it!
# Choose the plot size (width x height, in inches)
plt.figure(figsize=(7,7))

# Use the Geostationary projection in cartopy
ax = plt.axes(projection=ccrs.Geostationary(central_longitude=-75.0, satellite_height=35786023.0))
img_extent = (-5434894.67527,5434894.67527,-5434894.67527,5434894.67527)

# Add coastlines, borders and gridlines
ax.coastlines(resolution='10m', color='white', linewidth=0.8)
ax.add_feature(cartopy.feature.BORDERS, edgecolor='white', linewidth=0.8)
ax.gridlines(color='white', alpha=0.5, linestyle='--', linewidth=0.5)

# Plot the image
img = ax.imshow(RGB, origin='upper', extent=img_extent)

# Add a title
plt.title('GOES-16 Airmass RGB', fontweight='bold', fontsize=10, loc='left')
plt.title('Full Disk', fontsize=10, loc='right')

# Save the image
plt.tight_layout()
plt.savefig('Image_06.png')

# Show the image
plt.show()
This should be your full script by now:
# Training: Python and GOES-R Imagery: Script 6

# Required modules
from netCDF4 import Dataset                # Read / Write NetCDF4 files
import matplotlib.pyplot as plt            # Plotting library
import cartopy, cartopy.crs as ccrs        # Plot maps
import numpy as np                         # Import the Numpy packag

# Open the GOES-R image
file1 = Dataset("OR_ABI-L2-CMIPF-M6C08_G16_s20191981200396_e20191981210104_c20191981210182.nc")
# Get the pixel values, and convert to Celsius
data1 = file1.variables['CMI'][:] - 273.15

# Open the GOES-R image
file2 = Dataset("OR_ABI-L2-CMIPF-M6C10_G16_s20191981200396_e20191981210116_c20191981210188.nc")
# Get the pixel values, and convert to Celsius
data2 = file2.variables['CMI'][:] - 273.15

# Open the GOES-R image
file3 = Dataset("OR_ABI-L2-CMIPF-M6C12_G16_s20191981200396_e20191981210111_c20191981210185.nc")
# Get the pixel values, and convert to Celsius
data3 = file3.variables['CMI'][:] - 273.15

# Open the GOES-R image
file4 = Dataset("OR_ABI-L2-CMIPF-M6C13_G16_s20191981200396_e20191981210116_c20191981210189.nc")
# Get the pixel values, and convert to Celsius
data4 = file4.variables['CMI'][:] - 273.15

# RGB Components
R = data1 - data2
G = data3 - data4
B = data1

# Minimuns, Maximuns and Gamma
Rmin = -26.2
Rmax = 0.6

Gmin = -43.2
Gmax = 6.7

Bmin = -29.25
Bmax = -64.65
R[R>Rmax] = Rmax R[R<Rmin] = Rmin G[G>Gmax] = Gmax G[G<Gmin] = Gmin B[B<Bmax] = Bmax B[B>Bmin] = Bmin
gamma_R = 1
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# Eliminate values outside the globe
mask = (RGB == [R[0,0],G[0,0],B[0,0]]).all(axis=2)
RGB[mask] = np.nan

# Choose the plot size (width x height, in inches)
plt.figure(figsize=(7,7))

# Use the Geostationary projection in cartopy
ax = plt.axes(projection=ccrs.Geostationary(central_longitude=-75.0, satellite_height=35786023.0))
img_extent = (-5434894.67527,5434894.67527,-5434894.67527,5434894.67527)

# Add coastlines, borders and gridlines
ax.coastlines(resolution='10m', color='white', linewidth=0.8)
ax.add_feature(cartopy.feature.BORDERS, edgecolor='white', linewidth=0.8)
ax.gridlines(color='white', alpha=0.5, linestyle='--', linewidth=0.5)

# Plot the image
img = ax.imshow(RGB, origin='upper', extent=img_extent)

# Add a title
plt.title('GOES-16 Airmass RGB', fontweight='bold', fontsize=10, loc='left')
plt.title('Full Disk', fontsize=10, loc='right')

# Save the image
plt.tight_layout()
plt.savefig('Image_06.png')

# Show the image
plt.show()

YOU MAY DOWNLOAD THE SCRIP ABOVE (Script_06.py) AT THIS LINK

Execute the script “Script_06.py” using the following command:

python Script_06.py

You should see the following plot: Airmass_Recipeb.jpg bulb-iconWhat can you quickly change in this script?
  • Create a full resolution plot. Try adjusting the script to produce a full resolution plot as we did in exercise 5.
  • Add states and provinces shapefiles. Try adding the states and provinces shapefiles as we did in exercise 5.
  • Create other RGB’s. Check the RAMMB RGB’s Quick Guides and try to create other RGB’s. The DUST RGB creation method is very similar! Try it out! Note: The blue channel is not inverted!

Last update: July 18th 19:00 UTC

GEONETCast-Americas Imagery of The Day [12]: Ubinas Volcano Eruption

ubinas_1.jpgubinas_4.jpgubinas_2.jpg

Imagery received on the GOES-R-RGB-Composites GNC-A folder (July 19th, 18:00 UTC) – GeoTIFF format.

Folder

Please find below the other posts from this Blog series:

New Operational GNC-A Station: Uruguayan Air Force (Station n° 86!)

IMG-20190708-WA0021 - Copia

Hi GEONETCasters,

The Meteorologial Service of the Uruguayan Air Force (FAU) kindly shared photos of their GEONETCast-Americas antenna.

Thanks for sharing!

Do you have a newly installed GNC-A instation that hasn’t been shown in the Blog? Please send us a photo to [email protected].

“New Operational GNC-A Station” Series:

GOEs-R and JPSS Patches GNC
Cool GOES-R and JPSS-1 patches near a GNC-A DVB-S2 receiver.

Products Generated by the Community [20]

image.png

SERVIR Regional Visualization and Monitoring System – Developed by CATHALAC, Panama – GOES-16 imagery processed using this Blog’s tutorials as a reference

Hi community,

CATHALAC, the Water Center for the Humid Tropics of Latin America and the Caribbean from Panama kindly shared information on their SERVIR platform (Web and App).

The SERVIR system provides valuable information for the monitoring and analysis of meteorological phenomena, including satellite imagery, rainfall and surface forecasts, winds, ultraviolet index, earthquake monitoring and other specialized studies.

As for the satellite imagery available on SERVIR, Juan Benavides, main SERVIR developer, says:

The entire technological platform for the analysis of GOES-R satellite imagery that we have developed in Python could be done thanks to the documentation provided in the Blog.

Thanks for sharing CATHALAC! Please find below some screenshots:

SERVIR_IR.jpgSERVIR_VIS.jpgSERVIR_IR_2.jpg

Please access a nice presentation by clicking at the following image:

SERVIR_cover.jpg

Community Development.png

This Blog series shows the products developed by the community in the Americas. Most of them refers to data received from GNC-A, however, we also post the development with data received from other means. Please find below the other posts from this series:

Python Script Examples to Generate GOES-16 / 17 RGB’s: Part III

g16_RGBs_III.png

This is the third part of this series. Please find the other parts at the following links:

Please find below other Python example scripts to generate GOES-16 / 17 RGB’s:

RGB_Day_Cloud_Convection_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Day Cloud Convection RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Day Cloud Convection
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_DayCloudConvectionRGB_final.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C02_G16_s20191841700283_e20191841709591_c20191841710072-114300_0.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1
G = data1
B = data2

# Minimuns and Maximuns
Rmin = 0.0
Rmax = 1.0

Gmin = 0.0
Gmax = 1.0

Bmin = 49.85
Bmax = -70.15

R[RRmax] = Rmax

G[GGmax] = Gmax

B[B>Bmin] = Bmin
B[B<Bmax] = Bmax

# Choose the gamma
gamma_R = 1.7
gamma_G = 1.7
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.3,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Day_Cloud_Convection.png', dpi=DPI, pad_inches=0)

RGB_24-h_Microphysics_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – 24-hour Microphysics RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: 24-hour Microphysics
# Quick Guide: http://eumetrain.org/rgb_quick_guides/quick_guides/24MicroRGB.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C15_G16_s20191841700283_e20191841709596_c20191841710080.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C11_G16_s20191841700283_e20191841709591_c20191841710080.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data2 - data3
B = data2

# Minimuns and Maximuns
Rmin = -4.0
Rmax = 2.0

Gmin = 0.0
Gmax = 6.0

Bmin = -25.10
Bmax = 29.8

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 1.2
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================
# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_24h_Microphysics.png', dpi=DPI, pad_inches=0)

RGB_Night_Microphysics_Summer_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Night Microphysics RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Night Microphysics
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_NtMicroRGB_final.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C15_G16_s20191850300287_e20191850310001_c20191850310084.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191850300287_e20191850310006_c20191850310084.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C07_G16_s20191850300287_e20191850310006_c20191850310078.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data2 - data3
B = data2

# Minimuns and Maximuns
Rmin = -6.7
Rmax = 2.6

Gmin = -3.1
Gmax = 5.2

Bmin = -29.60
Bmax = 19.5

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Night_Microphysics.png', dpi=DPI, pad_inches=0)

RGB_Cloud_Phase_EUM_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Cloud Phase RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Day Land Cloud RGB
# Quick Guide: http://eumetrain.org/rgb_quick_guides/quick_guides/CloudPhaseRGB.pdf

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C05_G16_s20191841700283_e20191841709591_c20191841710071.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C06_G16_s20191841700283_e20191841709596_c20191841710062.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C02_G16_s20191841700283_e20191841709591_c20191841710072-114300_0.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()

# Calculates the solar zenith angle
from pyorbital import astronomy
from datetime import datetime

lat = np.linspace(extent[3], extent[1], data1.shape[0])
lon = np.linspace(extent[0], extent[2], data1.shape[1])

xx,yy = np.meshgrid(lon,lat)
lats = xx.reshape(data1.shape[0], data1.shape[1])
lons = yy.reshape(data1.shape[0], data1.shape[1])

# Get the year month day hour and minute to apply the zenith correction
utc_time = datetime(2019, 7, 3, 17, 00)
sun_zenith = np.zeros((data1.shape[0], data1.shape[1]))
sun_zenith = astronomy.sun_zenith_angle(utc_time, lats, lons)

# Apply the sun zenith correction
data1 = (data1)/(np.cos(np.deg2rad(sun_zenith)))
data2 = (data2)/(np.cos(np.deg2rad(sun_zenith)))
data3 = (data3)/(np.cos(np.deg2rad(sun_zenith)))

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1
G = data2
B = data3

# Minimuns and Maximuns
Rmin = 0
Rmax = 1

Gmin = 0
Gmax = 1

Bmin = 0
Bmax = 1

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================
# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.3,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Cloud_Phase.png', dpi=DPI, pad_inches=0)

RGB_So2_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – SO2 RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: SO2
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/Quick_Guide_SO2_RGB.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C09_G16_s20191841700283_e20191841709596_c20191841710081.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C10_G16_s20191841700283_e20191841710002_c20191841710078.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# File to read
image4 = "OR_ABI-L2-CMIPF-M6C11_G16_s20191841700283_e20191841709591_c20191841710080.nc"
# Read the file using the NetCDF library
file4 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data4 = grid.ReadAsArray()
# Convert to Celsius
data4 = data4 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data3 - data4
B = data3

# Minimuns and Maximuns
Rmin = -4.0
Rmax = 2.0

Gmin = -4.0
Gmax = 5.0

Bmin = -30.1
Bmax = 29.8

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 1.2
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_SO2.png', dpi=DPI, pad_inches=0)

Python Script Examples to Generate GOES-16 / 17 RGB’s: Part II

GOES-R-RGB-Tutorial-2.png

This is the second part of this series. Please find the first part at the following link:

Please find below other Python example scripts to generate GOES-16 / 17 RGB’s:

RGB_Natural_True_Colors_g16

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Natural True Color RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
####################################################################################################### 

# Python Script: Natural True Color RGB
# Quick Guide: http://cimss.ssec.wisc.edu/goes/OCLOFactSheetPDFs/ABIQuickGuide_CIMSSRGB_v2.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C02_G16_s20191841700283_e20191841709591_c20191841710072-114300_0.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-55, -26, -43, -19]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C03_G16_s20191841700283_e20191841709591_c20191841710072.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-55, -26, -43, -19]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C01_G16_s20191841700283_e20191841709591_c20191841710066.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-55, -26, -43, -19]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1
G = (0.45 * data1) + (0.1 * data2) + (0.45 * data3)
B = data3

# Minimuns and Maximuns
Rmin = 0
Rmax = 1

Gmin = 0
Gmax = 1

Bmin = 0
Bmax = 1

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma = 2

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.3,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Natural_True_Colors.png', dpi=DPI, pad_inches=0)

RGB_Day_Snow_Fog_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Day Snow Fog RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Day Snow Fog RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_DaySnowFog.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C07_G16_s20191841700283_e20191841710002_c20191841710072.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
#data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
#data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C03_G16_s20191841700283_e20191841709591_c20191841710072.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()

# File to read
image4 = "OR_ABI-L2-CMIPF-M6C05_G16_s20191841700283_e20191841709591_c20191841710071.nc"
# Read the file using the NetCDF library
file4 = Dataset(image4)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image4, extent, resolution)
# Read the data as an array
data4 = grid.ReadAsArray()

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# Calculate the solar zenith angle
from pyorbital import astronomy
from datetime import datetime
utc_time = datetime(2019, 7, 3, 17, 00)

lat = np.linspace(extent[3], extent[1], data1.shape[0])
lon = np.linspace(extent[0], extent[2], data1.shape[1])
zenith = np.zeros((data1.shape[0], data1.shape[1]))

for x in range(len(lat)):
for y in range(len(lon)):
zenith[x,y] = astronomy.sun_zenith_angle(utc_time, lon[y], lat[x])
#zenith[zenith > 90] = np.nan

print("Solar Zenith Angle calculus finished")

# Calculate the solar component (band 3.7 um)
from pyspectral.near_infrared_reflectance import Calculator
refl39 = Calculator('GOES-16', 'abi', 'ch7')
data1b = refl39.reflectance_from_tbs(zenith, data1, data2)
print("Solar Component calculus finished")

# RGB Components
R = data3
G = data4
B = data1b

# Minimuns and Maximuns

Rmin = 0
Rmax = 1

Gmin = 0
Gmax = 0.7

Bmin = 0
Bmax = 0.3

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1.7
gamma_G = 1.7
gamma_B = 1.7

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================
# Create the basemap bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010', 'estados2010', linewidth=0.3, color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.3, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.3, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.4, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.4, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Day_Snow_Fog.png', dpi=DPI, pad_inches=0)

RGB_Differential_Water_Vapor_g16

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Differential Water Vapor RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Differential Water Vapor RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DifferentialWaterVaporRGB_final.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C10_G16_s20191841700283_e20191841710002_c20191841710078.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C08_G16_s20191841700283_e20191841709591_c20191841710070.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data1
B = data2

# Minimuns and Maximuns
Rmin = 30
Rmax = -3

Gmin = 5
Gmax = -60

Bmin = -29.25
Bmax = -64.65

R[RRmin] = Rmin

G[GGmin] = Gmin

B[BBmin] = Bmin

# Choose the gamma
gamma_R = 3.5
gamma_G = 2.5
gamma_B = 2.5

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Differential_Water_Vapor.png', dpi=DPI, pad_inches=0)

RGB_Dust_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Dust RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Dust RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/Dust_RGB_Quick_Guide.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C15_G16_s20191841700283_e20191841709596_c20191841710080.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C14_G16_s20191841700283_e20191841709591_c20191841710083.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# File to read
image4 = "OR_ABI-L2-CMIPF-M6C11_G16_s20191841700283_e20191841709591_c20191841710080.nc"
# Read the file using the NetCDF library
file4 = Dataset(image4)
# Resolução Desejada
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image4, extent, resolution)
# Read the data as an array
data4 = grid.ReadAsArray()
# Convert to Celsius
data4 = data4 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data3 - data4
B = data2

# Minimuns and Maximuns
Rmin = -6.7
Rmax = 2.6

Gmin = -0.5
Gmax = 20

Bmin = -11.95
Bmax = 15.55

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 2.5
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Dust.png', dpi=DPI, pad_inches=0)

RGB_Fire_Temperature_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Fire Temperature RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Fire Temperature RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/Fire_Temperature_RGB.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C07_G16_s20191841700283_e20191841710002_c20191841710072.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-55, -26, -43, -19]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C06_G16_s20191841700283_e20191841709596_c20191841710062.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-55, -26, -43, -19]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C05_G16_s20191841700283_e20191841709591_c20191841710071.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-55, -26, -43, -19]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()

# Calculates the solar zenith angle
from pyorbital import astronomy
from datetime import datetime

lat = np.linspace(extent[3], extent[1], data1.shape[0])
lon = np.linspace(extent[0], extent[2], data1.shape[1])

xx,yy = np.meshgrid(lon,lat)
lats = xx.reshape(data1.shape[0], data1.shape[1])
lons = yy.reshape(data1.shape[0], data1.shape[1])

# Get the year month day hour and minute to apply the zenith correction
utc_time = datetime(2019, 7, 3, 17, 00)
sun_zenith = np.zeros((data1.shape[0], data1.shape[1]))
sun_zenith = astronomy.sun_zenith_angle(utc_time, lats, lons)

# Apply the sun zenith correction
data2 = (data2)/(np.cos(np.deg2rad(sun_zenith)))
data3 = (data3)/(np.cos(np.deg2rad(sun_zenith)))

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1
G = data2
B = data3

# Minimuns and Maximuns
Rmin = 0
Rmax = 60

Gmin = 0
Gmax = 1

Bmin = 0
Bmax = 0.75

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 0.4
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Fire_Temperature.png', dpi=DPI, pad_inches=0)

RGB_Simple_Water_Vapor_g16

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Simple Water RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
####################################################################################################### 

# Python Script: Simple Water Vapor RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/Simple_Water_Vapor_RGB.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C08_G16_s20191841700283_e20191841709591_c20191841710070.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C10_G16_s20191841700283_e20191841710002_c20191841710078.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
#extent = [-156.29, -81.32, 6.29, 81.32]
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1
G = data2
B = data3

# Minimuns and Maximuns
Rmin = 5.81
Rmax = -70.86

Gmin = -30.48
Gmax = -58.49

Bmin = -12.12
Bmax = -28.03

R[RRmin] = Rmin

G[GGmin] = Gmin

B[BBmin] = Bmin

# Choose the gamma
gamma_R = 1
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326)

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Simple_Water_Vapor.png', dpi=DPI, pad_inches=0)

RGB_Night_Microphysics_Summer_g16.jpg

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Night Microphysics
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_NtMicroRGB_final.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C15_G16_s20191850300287_e20191850310001_c20191850310084.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191850300287_e20191850310006_c20191850310084.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C07_G16_s20191850300287_e20191850310006_c20191850310078.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data2 - data3
B = data2

# Minimuns and Maximuns
Rmin = -6.7
Rmax = 2.6

Gmin = -3.1
Gmax = 5.2

Bmin = -29.60
Bmax = 19.5

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Night_Microphysics.png', dpi=DPI, pad_inches=0)

Python Script Examples to Generate GOES-16 / 17 RGB’s: Part I

GOES-R-RGB-Tutorial.png

Hi community,

Now that we know how to download GOES-16 / GOES-17 data from the cloud for free (see here, here, here and here) to complement the data in our GNC-A station (or to just download everything from there, if you have enough bandwidth), let’s see how to create GOES-16 / GOES-16 RGB’s from zero, with scripts that are very easy to understand.

RGB_Airmass_g16

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Airmass RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Airmass RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_AirMassRGB_final.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C08_G16_s20191841700283_e20191841709591_c20191841710070.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C10_G16_s20191841700283_e20191841710002_c20191841710078.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C12_G16_s20191841700283_e20191841709596_c20191841710078.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# File to read
image4 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file4 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image4, extent, resolution)
# Read the data as an array
data4 = grid.ReadAsArray()
# Convert to Celsius
data4 = data4 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data3 - data4
B = data1

# Minimuns and Maximuns
Rmin = -26.2
Rmax = 0.6

Gmin = -43.2
Gmax = 6.7

Bmin = -29.25
Bmax = -64.65

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmin] = Bmin

# Choose the gamma
gamma = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Airmass.png', dpi=DPI, pad_inches=0)

RGB_Ash_g16

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Ash RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Ash RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/GOES_Ash_RGB.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C15_G16_s20191841700283_e20191841709596_c20191841710080.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C14_G16_s20191841700283_e20191841709591_c20191841710083.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# File to read
image4 = "OR_ABI-L2-CMIPF-M6C11_G16_s20191841700283_e20191841709591_c20191841710080.nc"
# Read the file using the NetCDF library
file4 = Dataset(image4)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image4, extent, resolution)
# Read the data as an array
data4 = grid.ReadAsArray()
# Convert to Celsius
data4 = data4 - 273.15

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data3 - data4
B = data2

# Minimuns and Maximuns
Rmin = -6.7
Rmax = 2.6

Gmin = -6.0
Gmax = 6.3

Bmin = -29.55
Bmax = 29.25

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B)

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Ash.png', dpi=DPI, pad_inches=0)

RGB_Cloud_Phase_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Cloud Phase Distinction RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Day Cloud Phase Distinction RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/Day_Cloud_Phase_Distinction.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C02_G16_s20191841700283_e20191841709591_c20191841710072-114300_0.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C05_G16_s20191841700283_e20191841709591_c20191841710071.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1
G = data2
B = data3

# Minimuns and Maximuns
Rmin = -53.5
Rmax = 7.5

Gmin = 0.0
Gmax = 0.78

Bmin = 0.01
Bmax = 0.59

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma = 1

# Normalize the data
R = ((R - Rmax) / (Rmin - Rmax)) ** (1/gamma)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.6,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.6, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.6, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.8, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.8, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Cloud_Phase.png', dpi=DPI, pad_inches=0)

RGB_Day_Convection_g16

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Day Convection RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Day Convection RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_DayConvectionRGB_final.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C08_G16_s20191841700283_e20191841709591_c20191841710070.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C10_G16_s20191841700283_e20191841710002_c20191841710078.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C07_G16_s20191841700283_e20191841710002_c20191841710072.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()
# Convert to Celsius
data3 = data3 - 273.15

# File to read
image4 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file4 = Dataset(image4)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image4, extent, resolution)
# Read the data as an array
data4 = grid.ReadAsArray()
# Convert to Celsius
data4 = data4 - 273.15

# File to read
image5 = "OR_ABI-L2-CMIPF-M6C05_G16_s20191841700283_e20191841709591_c20191841710071.nc"
# Read the file using the NetCDF library
file5 = Dataset(image5)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image5, extent, resolution)
# Read the data as an array
data5 = grid.ReadAsArray()

# File to read
image6 = "OR_ABI-L2-CMIPF-M6C02_G16_s20191841700283_e20191841709591_c20191841710072-114300_0.nc"
# Read the file using the NetCDF library
file6 = Dataset(image6)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image6, extent, resolution)
# Read the data as an array
data6 = grid.ReadAsArray()

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1 - data2
G = data3 - data4
B = data5 - data6

# Minimuns and Maximuns
Rmin = -35.0
Rmax = 5

Gmin = -5.0
Gmax = 60

Bmin = -0.75
Bmax = 0.25

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.3,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.3, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.3, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.4, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.4, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Day_Convection.png', dpi=DPI, pad_inches=0)

RGB_Day_Land_Cloud_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Day Land Cloud RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Day Land Cloud RGB
# Quick Guide: http://rammb.cira.colostate.edu/training/visit/quick_guides/QuickGuide_GOESR_daylandcloudRGB_final.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C06_G16_s20191841700283_e20191841709596_c20191841710062.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C03_G16_s20191841700283_e20191841709591_c20191841710072.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C02_G16_s20191841700283_e20191841709591_c20191841710072-114300_0.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()

# Calculates the solar zenith angle
from pyorbital import astronomy
from datetime import datetime

lat = np.linspace(extent[3], extent[1], data1.shape[0])
lon = np.linspace(extent[0], extent[2], data1.shape[1])

xx,yy = np.meshgrid(lon,lat)
lats = xx.reshape(data1.shape[0], data1.shape[1])
lons = yy.reshape(data1.shape[0], data1.shape[1])

# Get the year month day hour and minute to apply the zenith correction
utc_time = datetime(2019, 7, 3, 17, 00)
sun_zenith = np.zeros((data1.shape[0], data1.shape[1]))
sun_zenith = astronomy.sun_zenith_angle(utc_time, lats, lons)

# Apply the sun zenith correction
data1 = (data1)/(np.cos(np.deg2rad(sun_zenith)))
data2 = (data2)/(np.cos(np.deg2rad(sun_zenith)))
data3 = (data3)/(np.cos(np.deg2rad(sun_zenith)))

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# RGB Components
R = data1
G = data2
B = data3

# Minimuns and Maximuns
Rmin = 0
Rmax = 1

Gmin = 0
Gmax = 1

Bmin = 0
Bmax = 1

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 1
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================

# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010','estados_2010',linewidth=0.3,color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.3, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.3, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.4, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.4, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Day_Land_Cloud.png', dpi=DPI, pad_inches=0)

RGB_Day_Microphysics_Summer_g16.jpg

Hurricane Barbara – GOES-16 – July 3rd 2019, 17:00 UTC – Day Microphysics RGB created with Python

#######################################################################################################
# LICENSE
# Copyright (C) 2019 - INPE - NATIONAL INSTITUTE FOR SPACE RESEARCH
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
#######################################################################################################

# Python Script: Day Microphysics RGB
# Quick Guide: https://weather.msfc.nasa.gov/sport/training/quickGuides/rgb/QuickGuide_DtMicroRGB_NASA_SPoRT.pdf

# Required modules
import matplotlib.pyplot as plt           # Import the Matplotlib package
import numpy as np                        # Import the Numpy package
from netCDF4 import Dataset               # Import the NetCDF Python interface
from remap import remap                   # Import the Remap function
from mpl_toolkits.basemap import Basemap  # Import the Basemap utility

# File to read
image1 = "OR_ABI-L2-CMIPF-M6C07_G16_s20191841700283_e20191841710002_c20191841710072.nc"
# Read the file using the NetCDF library
file1 = Dataset(image1)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image1, extent, resolution)
# Read the data as an array
data1 = grid.ReadAsArray()
# Convert to Celsius
#data1 = data1 - 273.15

# File to read
image2 = "OR_ABI-L2-CMIPF-M6C13_G16_s20191841700283_e20191841710002_c20191841710081.nc"
# Read the file using the NetCDF library
file2 = Dataset(image2)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the brightness temperatures
grid = remap(image2, extent, resolution)
# Read the data as an array
data2 = grid.ReadAsArray()
# Convert to Celsius
#data2 = data2 - 273.15

# File to read
image3 = "OR_ABI-L2-CMIPF-M6C03_G16_s20191841700283_e20191841709591_c20191841710072.nc"
# Read the file using the NetCDF library
file3 = Dataset(image3)
# Desired resolution
resolution = 2
# Desired extent
extent = [-138, 5.0, -112, 24.0]
# Remap and get the reflectances
grid = remap(image3, extent, resolution)
# Read the data as an array
data3 = grid.ReadAsArray()

# Define the size of the saved picture=================================================================
#plt.figure(figsize=(10,6))
DPI = 150
fig = plt.figure(figsize=(data1.shape[1]/float(DPI), data1.shape[0]/float(DPI)), frameon=False, dpi=DPI)
ax = plt.Axes(fig, [0., 0., 1., 1.])
ax.set_axis_off()
fig.add_axes(ax)
ax = plt.axis('off')
# ====================================================================================================

# Calculate the solar zenith angle
from pyorbital import astronomy
from datetime import datetime
utc_time = datetime(2019, 7, 3, 17, 00)

lat = np.linspace(extent[3], extent[1], data1.shape[0])
lon = np.linspace(extent[0], extent[2], data1.shape[1])
zenith = np.zeros((data1.shape[0], data1.shape[1]))

for x in range(len(lat)):
    for y in range(len(lon)):
       zenith[x,y] = astronomy.sun_zenith_angle(utc_time, lon[y], lat[x])
#zenith[zenith > 90] = np.nan

print("Solar Zenith Angle calculus finished")

# Calculate the solar component (band 3.7 um)

from pyspectral.near_infrared_reflectance import Calculator
refl39 = Calculator('GOES-16', 'abi', 'ch7')
data1b = refl39.reflectance_from_tbs(zenith, data1, data2)
print("Solar Component calculus finished")

# RGB Components
R = data3
G = data1b
B = data2

# Minimuns and Maximuns
Rmin = 0
Rmax = 1

Gmin = 0
Gmax = 0.6

Bmin = 203
Bmax = 323

R[RRmax] = Rmax

G[GGmax] = Gmax

B[BBmax] = Bmax

# Choose the gamma
gamma_R = 1
gamma_G = 2.5
gamma_B = 1

# Normalize the data
R = ((R - Rmin) / (Rmax - Rmin)) ** (1/gamma_R)
G = ((G - Gmin) / (Gmax - Gmin)) ** (1/gamma_G)
B = ((B - Bmin) / (Bmax - Bmin)) ** (1/gamma_B) 

# Create the RGB
RGB = np.stack([R, G, B], axis=2)

# ====================================================================================================
# Create the basemap
bmap = Basemap(llcrnrlon=extent[0], llcrnrlat=extent[1], urcrnrlon=extent[2], urcrnrlat=extent[3], epsg=4326, resolution = 'i')

# Plot the image
bmap.imshow(RGB, origin='upper')

# Insert a shapefile
bmap.readshapefile('estados_2010', 'estados2010', linewidth=0.3, color='white')

# Configure the map
bmap.drawcoastlines(linewidth=0.3, linestyle='solid', color='gold')
bmap.drawcountries(linewidth=0.3, linestyle='solid', color='orange')
bmap.drawparallels(np.arange(-90.0, 90.0, 5.0), dashes = [4 ,4], linewidth=0.4, color='cyan', labels=[True,False,False,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)
bmap.drawmeridians(np.arange(0.0, 360.0, 5.0), dashes = [4,4], linewidth=0.4, color='cyan', labels=[False,False,True,False], fmt='%g', labelstyle="+/-", xoffset= 0.00, yoffset= 0.00, size=7)

# Save the image
plt.savefig('RGB_Day_Microphysics_Summer.png', dpi=DPI, pad_inches=0)