Creating GOES-16 NDVI Composites With Python

GOES-16 NDVI composite created with Python (October 12 – 19, 2021)

We’re working on the content for an Agrometerology training course and NDVI composites will be one of the examples. Please find below an example script to create NDVI composites using GOES-16 NetCDF’s. This is a very nice example, the NetCDF’s are downloaded directly from the cloud, and you may select the start and end date for the accumulation. These composites will also be available in the next version of SHOWCast.

https://github.com/diegormsouza/Agrometeorology_Python_Oct_2021

#-----------------------------------------------------------------------------------------------------------
# Agrometeorology Course - Demonstration 2: Normalized Difference Vegetation Index (NDVI)
# Author: Diego Souza
#-----------------------------------------------------------------------------------------------------------
# Required modules
from netCDF4 import Dataset # Read / Write NetCDF4 files
import matplotlib.pyplot as plt # Plotting library
from datetime import datetime # Basic Dates and time types
from datetime import timedelta, date, datetime # Basic Dates and time types
import cartopy, cartopy.crs as ccrs # Plot maps
import cartopy.io.shapereader as shpreader # Import shapefiles
import numpy as np # Scientific computing with Python
import os # Miscellaneous operating system interfaces
from utilities import download_CMI # Our own utilities
from utilities import geo2grid, latlon2xy, convertExtent2GOESProjection # Our own utilities
#-----------------------------------------------------------------------------------------------------------
# Input and output directories
input = "/content/Samples"; os.makedirs(input, exist_ok=True)
output = "/content/Animation"; os.makedirs(output, exist_ok=True)
# Desired extent
extent = [-110.0, 0.00, -20.00, 50.00] # Min lon, Min lat, Max lon, Max lat
# Initial date and time to process
yyyymmddhhmn = '202110011800'
# Number of days to accumulate
ndays = 20
# Initial time and date
yyyy = datetime.strptime(yyyymmddhhmn, '%Y%m%d%H%M').strftime('%Y')
mm = datetime.strptime(yyyymmddhhmn, '%Y%m%d%H%M').strftime('%m')
dd = datetime.strptime(yyyymmddhhmn, '%Y%m%d%H%M').strftime('%d')
hh = datetime.strptime(yyyymmddhhmn, '%Y%m%d%H%M').strftime('%H')
mn = datetime.strptime(yyyymmddhhmn, '%Y%m%d%H%M').strftime('%M')
date_ini = str(datetime(int(yyyy),int(mm),int(dd),int(hh),int(mn)))
# Choose number of days ahead
date_end = str(datetime(int(yyyy),int(mm),int(dd),int(hh),int(mn)) + timedelta(days=ndays))
#-----------------------------------------------------------------------------------------------------------
# NDVI colormap creation
import matplotlib
colors = ["#8f2723", "#8f2723", "#8f2723", "#8f2723", "#af201b", "#af201b", "#af201b", "#af201b", "#ce4a2e", "#ce4a2e", "#ce4a2e", "#ce4a2e",
"#df744a", "#df744a", "#df744a", "#df744a", "#f0a875", "#f0a875", "#f0a875", "#f0a875", "#fad398", "#fad398", "#fad398", "#fad398",
"#fff8ba",
"#d8eda0", "#d8eda0", "#d8eda0", "#d8eda0", "#bddd8a", "#bddd8a", "#bddd8a", "#bddd8a", "#93c669", "#93c669", "#93c669", "#93c669",
"#5da73e", "#5da73e", "#5da73e", "#5da73e", "#3c9427", "#3c9427", "#3c9427", "#3c9427", "#235117", "#235117", "#235117", "#235117"]
cmap = matplotlib.colors.LinearSegmentedColormap.from_list("", colors)
cmap.set_over('#235117')
cmap.set_under('#8f2723')
vmin = 0.1
vmax = 0.8
#-----------------------------------------------------------------------------------------------------------
# Variable to check if is the first iteration
first = True
while (date_ini <= date_end):
# Date structure
yyyymmddhhmn = datetime.strptime(date_ini, '%Y-%m-%d %H:%M:%S').strftime('%Y%m%d%H%M')
print(yyyymmddhhmn)
# Download the file for Band 02
file_name_ch02 = download_CMI(yyyymmddhhmn, '2', input)
# Download the file for Band 03
file_name_ch03 = download_CMI(yyyymmddhhmn, '3', input)
#-----------------------------------------------------------------------------------------------------------
# If one the files hasn't been downloaded for some reason, skip the current iteration
if not (os.path.exists(f'{input}/{file_name_ch02}.nc')) or not (os.path.exists(f'{input}/{file_name_ch03}.nc')):
# Increment the date_ini
date_ini = str(datetime.strptime(date_ini, '%Y-%m-%d %H:%M:%S') + timedelta(days=1))
print("The file is not available, skipping this iteration.")
continue
# Open the GOES-R image (Band 02)
file = Dataset(f'{input}/{file_name_ch02}.nc')
# Convert lat/lon to grid-coordinates
lly, llx = geo2grid(extent[1], extent[0], file)
ury, urx = geo2grid(extent[3], extent[2], file)
# Get the pixel values
data_ch02 = file.variables['CMI'][ury:lly, llx:urx][::2 ,::2]
#-----------------------------------------------------------------------------------------------------------
# Open the GOES-R image (Band 03)
file = Dataset(f'{input}/{file_name_ch03}.nc')
# Convert lat/lon to grid-coordinates
lly, llx = geo2grid(extent[1], extent[0], file)
ury, urx = geo2grid(extent[3], extent[2], file)
# Get the pixel values
data_ch03 = file.variables['CMI'][ury:lly, llx:urx]
#-----------------------------------------------------------------------------------------------------------
# Make the arrays equal size
cordX = np.shape(data_ch02)[0], np.shape(data_ch03)[0]
cordY = np.shape(data_ch02)[1], np.shape(data_ch03)[1]
minvalX = np.array(cordX).min()
minvalY = np.array(cordY).min()
data_ch02 = data_ch02[0:minvalX, 0:minvalY]
data_ch03 = data_ch03[0:minvalX, 0:minvalY]
#-----------------------------------------------------------------------------------------------------------
# Calculate the NDVI
data = (data_ch03 - data_ch02) / (data_ch03 + data_ch02)
#-----------------------------------------------------------------------------------------------------------
# Compute data-extent in GOES projection-coordinates
img_extent = convertExtent2GOESProjection(extent)
#-----------------------------------------------------------------------------------------------------------
# If it's the first iteration, create the array that will store the max values
if (first == True):
first = False
ndvi_max = np.full((data_ch02.shape[0],data_ch02.shape[1]),-9999)
# Keep the maximuns, ignoring the nans
ndvi_max = np.fmax(data,ndvi_max)
# Remove low values from the accumulation
#ndvi_max[ndvi_max < 0.1] = np.nan
# Choose the plot size (width x height, in inches)
plt.figure(figsize=(10,10))
# Use the Geostationary projection in cartopy
ax = plt.axes(projection=ccrs.Geostationary(central_longitude=-75.0, satellite_height=35786023.0))
# Add a land mask
ax.stock_img()
import cartopy.feature as cfeature
land = ax.add_feature(cfeature.LAND, facecolor='gray', zorder=1)
# Plot the image
img = ax.imshow(ndvi_max, origin='upper', vmin=vmin, vmax=vmax, extent=img_extent, cmap=cmap, zorder=2)
# Add an ocean mask
ocean = ax.add_feature(cfeature.OCEAN, facecolor='lightsteelblue', zorder=3)
# Add a shapefile
shapefile = list(shpreader.Reader('ne_10m_admin_1_states_provinces.shp').geometries())
ax.add_geometries(shapefile, ccrs.PlateCarree(), edgecolor='dimgray',facecolor='none', linewidth=0.3, zorder=4)
# Add coastlines, borders and gridlines
ax.coastlines(resolution='10m', color='black', linewidth=0.8, zorder=5)
ax.add_feature(cartopy.feature.BORDERS, edgecolor='black', linewidth=0.5, zorder=6)
ax.gridlines(color='gray', alpha=0.5, linestyle='--', linewidth=0.5, xlocs=np.arange(-180, 180, 5), ylocs=np.arange(-90, 90, 5), zorder=7)
# Add a colorbar
plt.colorbar(img, label='Normalized Difference Vegetation Index', extend='both', orientation='horizontal', pad=0.05, fraction=0.05)
# Extract date
date = (datetime.strptime(file.time_coverage_start, '%Y-%m-%dT%H:%M:%S.%fZ'))
# Add a title
plt.title('GOES-16 NDVI ' + date.strftime('%Y-%m-%d %H:%M') + ' UTC', fontweight='bold', fontsize=10, loc='left')
plt.title('Reg.: ' + str(extent) , fontsize=10, loc='right')
#-----------------------------------------------------------------------------------------------------------
# Save the image
plt.savefig(f'{output}/G16_NDVI_{yyyymmddhhmn}.png', bbox_inches='tight', pad_inches=0, dpi=100)
# Show the image
plt.show()
# Increment the date_ini
date_ini = str(datetime.strptime(date_ini, '%Y-%m-%d %H:%M:%S') + timedelta(days=1))

GOES-16 NDVI composite created with Python (October 01 – 20, 2021)

New SHOWCast Release: v 2.5.1

Esta imagem possuí um atributo alt vazio; O nome do arquivo é showcast_logo.png

Please download SHOWCast v.2.5.1 at the link below:

SHOWCast v 2.5.1 Download

Based on user feedback, the following corrections have been made:

1-) Corrections in the installer: In some workstations, the support to the WebP image format was not available by default. The installer architecture has been changed, and now the correct libraries are installed for the WebP format support by default.

2-) Corrections in the interface: The “GOES-16 Data Products” and the “GCOM-W1 AMSR2” menus had the wrong links for some of the products.

3-) Corrections in the configuration scripts: The sectorized Airmass RGB extent configuration was missing. The Tsunami Warning configuration has been optimized.

4-) Corrections in the processing scripts: The Day Snow Fog RGB formula has been corrected.

Please find below the procedure to install SHOWCast v 2:

SHOWCast 2 Installation Procedure

Please find below previous posts about SHOWCast:

Technical Webinar for RA III and RA IV: Unidata INTERNET DATA DISTRIBUTION (IDD) 27th October 14h00-16h00 UTC

Dear colleagues:

We are pleased to invite you all to this technical webinar organized as part of the activities of the RA IV Focal Point on Satellite Data Requirement, Dr. Marcial Garbanzo which is extensive for RA III and RA IV experts

The webinar will be related to UNIDATA INTERNET DATA DISTRIBUTION (IDD) and will be held on October 27th 14h00-16h00 UTC

The agenda of the webinar is the following:

Agenda itemTime
Welcome remarks: Dr. Marcial Garbanzo, RA IV Focal Point on Satellite Data Requirements                            14h00-14h05  
Regional Priorities in the Americas and the Caribbean: the work of RA III and RA IV – Mr. Rodney Martínez (WMO)       14h05-14h15
UNIDATA Internet Data Distribution: Structure and Operations Dr. Tom Yoksas         quick overview of Unidata.the development of the Local Data Manager (LDM)the use of the LDM in the creation of the IDDsatellite data ingest making satellite (and lots of other data) available in the IDDhow the IDD feeds servers that we operate on behalf or the communitycomments about our activities in the various cloud environments  14h15-15h15  
Questions and Answers                                                                                                                                      15h15-15h30                        
Pilot initiatives and future training –  Dr. Marcial Garbanzo                                                                                    15h30-15h50                                                                          
Closing remarks – Mr. Rodney Martínez                                                                                                             15h50-16h00  

Please REGISTER HERE:

https://forms.office.com/Pages/ResponsePage.aspx?id=VL6m6odGxECYJ8BEvY6NPIpVOWAqof1Dmu_XS9V2F7JUQ0IzR1RRVzJZSDNIVTFFOTNQNEhCS1NRTi4u

The webinar will have interpretation English-Spanish

We will appreciate to share this invitation to the experts from your institutions.

Looking forward for your active participation!

With my best regards

Rodney Martínez Güingla
WMO Representative for North America, Central America, and the Caribbean
Member Services and Development Department

Recording / Presentations From The 11th GEONETCast-Americas User Group Webinar

GNC UGW.png

Hi GEONETCasters!

Please find below the recording and presentations from the 11th GEONETCast-Americas User Group Webinar (click on the images to download):

WEBINAR RECORDING

NOAA UPDATES

INPE UPDATES

Thank you to all the participants!

Please find the presentations from the other GEONETCast-Americas User Group Webinars, at the following links:

11th GEONETCast-Americas User Group Webinar

GNC UGW.png

Save The Date!

We will hold the next GNC-A User Group meeting on October 14th 2021 at 17:00 UTC / 13:00 EDT until 18:30 UTC / 13:30 EDT.

We will use Webex for the slides and voice. The link and telephone number are listed below.

Attendees can log into the WebEx 10 minutes prior to the meeting start time. Reminder to please mute your WebEx session unless you are speaking. WebEx users can also use the chat feature to provide questions to be addressed at the end of the presentation.

We will ask that you use the Webex Event as your audio and video.

Webex Meeting Link:
https://spsd.webex.com/spsd/j.php?MTID=m2f5bfffd0e08ba4bb3521f15f80e2249

Meeting number: 2760 834 0087
Password: gnc1

Join by video system:
Dial [email protected]

You can also dial 207.182.190.20 and enter your meeting number.

Join by phone
+1-415-527-5035 US Toll
Access code: 2760 834 0087

New SHOWCast Release: v 2.5.0

Esta imagem possuí um atributo alt vazio; O nome do arquivo é showcast_logo.png

Please download SHOWCast v.2.5.0 at the link below:

SHOWCast v 2.5.0 Download

SHOWCast v 2.5.1 Download

GOES-16 Full Disk RGB’s processed and visualized with SHOWCast 2.5

Changes on this version:

  • Processing and visualization of all 16 CMIPF bands:

All 16 GOES-16 CMIPF bands are processed and visualized in this new version. Users may select which band, resolution, sub-region and interval they would like to process.

All 16 GOES-16 CMIPF bands processed and visualized with SHOWCast 2.5
  • Processing and visualization of 20 GOES-16 RGB’s:

20 GOES-16 RGB’s are processed and visualized in this new version. Users may select which RGB, resolution, sub-region and interval they would like to process.

GOES-16 RGB’s (cylindrical equidistant projection) processed and visualized with SHOWCast 2.5
  • Processing and visualization of the JPSS vegetation products:

4 JPSS vegetation products are processed and visualized in this new version.

Green Vegetation Fraction, NDVI (TOA), NDVI (TOC) and EVI (TOC) processed with Python and displayed with SHOWCast 2.5. Users may select the region of interest for each product.
JPSS Green Vegetation Freaction (GVF) processed and visualized with SHOWCast 2.5
  • New GFS composite added by user request:

A new GFS composite was added to the visualzation menu by user request (PSML + 10m Wind > 10kt + Total Cloud Cover + Total Precipitation (3h) + 500-1000 hPa Thickness).

GFS composite: PSML + 10m Wind > 10kt + Total Cloud Cover + Total Precipitation (3h) + 500-1000 hPa Thickness processed and visualized with SHOWCast 2.5
  • New image format (WebP):

SHOWCast now works with the WebP format (instead of using PNG’s as on previous versions). The WebP format has the same quality of the PNG format, with a file size reduction of 30% – 80% depending on the image. Thus, the menus and animations load faster in comparison to previous versions.

  • Possible to choose which interval to plot (all GOES-R products):

Suppose you want to plot an specific GOES-R product every hour, or every 30 minutes only. Now it’s possible! For each GOES-R product, users may select which time steps they want to plot, giving users more options to adapt the processing according to the available hardware.

Selecting which time steps will be processed for a given product
  • Optimized Cloud Module:

When using the Cloud module (for AWS os UNIDATA), now the files are stored in a “tmp” directory during the download. When the download is finished, the file is moved from the “tmp” file to the final destination, as configured by the user. This avoids triggering the processing scripts with incomplete files.

Please find below the procedure to install SHOWCast v 2:

SHOWCast 2 Installation Procedure

Please find below previous posts about SHOWCast:

GOES-16 RGB’s (Python + SHOWCast)

GOES-16 RGB’s processed with Python and visualized with SHOWCast

As announced here, since September 14th all 16 GOES-16 CMIPF Bands are available in the GNC-A broadcast. This makes possible the creation of any RGB composite. The Python scripts have been created and in the next SHOWCast release the visualization of 20 RGB composites will be available.

GOES-16 RGB’s processed with Python and visualized with SHOWCast

Stay tuned for news!