In this tutorial, we will learn about how to remap satellite data to a uniform grid. This process involves mapping the data to a uniform grid, which makes it simpler to view, manipulate, and store. The tutorial will focus on remapping a VIIRS L2 Fire Mask Granule.
Author: Benjamin Marchant
from pylab import matplotlib
from datetime import date
from os import path
from scipy.spatial.distance import cdist
from scipy.interpolate import griddata
from scipy.interpolate.interpnd import _ndim_coords_from_arrays
from scipy.spatial import cKDTree
import urllib.request
import urllib.request, json
import pprint
import os
import pandas as pd
import glob
import netCDF4
import random
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.cm as cm
import numpy as np
import numpy.ma as ma
import warnings
import cartopy.crs as ccrs
import numpy.ma as ma
from matplotlib.pyplot import figure
warnings.filterwarnings('ignore')
You can download the file used in this tutorial by clicking on the provided link:
https://drive.google.com/file/d/1hp5vdonRXYNJ2AEgk-RS_rtij0GSSzy6/view?usp=sharing
filename = 'VNP14IMG.A2019215.2106.001.2019216045602.nc'
file_name = "/Volumes/HD2/Datasets/Research//NASA/Suomi-NPP/VIIRS/VNP14IMG/2019/2019_08_03/VNP14IMG.A2019215.2106.001.2019216045602.nc"
time_stamp = '{}.{}'.format(filename.split('.')[1],filename.split('.')[2])
time_stamp
f = netCDF4.Dataset(file_name)
def plot_fire_mask(data,filename,show_plot,dpi,nb_ticks):
cmap = cm.get_cmap('RdBu_r', 11) # PiYG
color_list = ['#808080']
for i in range(cmap.N):
rgba = cmap(i)
color_list.append(matplotlib.colors.rgb2hex(rgba))
fig = figure(num=None, figsize=(12, 10), dpi=dpi, facecolor='w', edgecolor='k')
ax = fig.add_subplot(111)
cmap = color_list
cmap = mpl.colors.ListedColormap(cmap)
bounds = [i for i in range(11)]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
img = plt.imshow(data, cmap=cmap, norm=norm, interpolation='none')
cbar_bounds = bounds
cbar_ticks = [(cbar_bounds[i+1]-cbar_bounds[i])/2.0+cbar_bounds[i] for i in range( len(cbar_bounds) - 1 )] # [0.5, 1.5, 155.0, 254.0, 255.0]
cbar_labels = [i for i in range(10)]
cbar = plt.colorbar(img, cmap=cmap, norm=norm, boundaries=cbar_bounds, ticks=cbar_ticks)
cbar.ax.set_yticklabels(cbar_labels, fontsize=10)
plt.title('FRP MASK')
plt.grid(c='black',ls='--')
plt.xticks(np.linspace(0, data.shape[1], nb_ticks))
plt.yticks(np.linspace(0, data.shape[0], nb_ticks))
ax.spines['bottom'].set_color('black')
ax.spines['top'].set_color('black')
ax.spines['left'].set_color('black')
ax.spines['right'].set_color('black')
#plt.savefig('Fire_mask.png', dpi=200, bbox_inches='tight')
if show_plot:
plt.show()
plt.close()
return None
masked_data = f.variables['fire mask']
data = ma.getdata(masked_data)
filename = 'test'
plot_fire_mask(data,filename,show_plot=True,dpi=200,nb_ticks=10)
frp_mask_data = ma.getdata(masked_data)
agg_y1 = 640
agg_y2 = 368
agg_y3 = 592
idx_bounds = [0,
agg_y1*2,
(agg_y1+agg_y2)*2,
(agg_y1+agg_y2+2*agg_y3)*2,
(agg_y1+agg_y2+2*agg_y3+agg_y2)*2,
(agg_y1+agg_y2+2*agg_y3+agg_y2+agg_y1)*2]
idx_bounds
data_img_01 = data[:,0:agg_y1*2]
data_img_02 = data[:,agg_y1*2:(agg_y1+agg_y2)*2]
data_img_03 = data[:,(agg_y1+agg_y2)*2:(agg_y1+agg_y2+2*agg_y3)*2]
data_img_04 = data[:,(agg_y1+agg_y2+2*agg_y3)*2:(agg_y1+agg_y2+2*agg_y3+agg_y2)*2]
data_img_05 = data[:,(agg_y1+agg_y2+2*agg_y3+agg_y2)*2:]
imgs_list = [data_img_01,data_img_02,data_img_03,data_img_04,data_img_05]
plot_fire_mask(data_img_01,filename,show_plot=True,dpi=200,nb_ticks=5)
plot_fire_mask(data_img_02,filename,show_plot=True,dpi=200,nb_ticks=3)
plot_fire_mask(data_img_03,filename,show_plot=True,dpi=200,nb_ticks=5)
plot_fire_mask(data_img_04,filename,show_plot=True,dpi=200,nb_ticks=3)
plot_fire_mask(data_img_05,filename,show_plot=True,dpi=200,nb_ticks=5)
f.close()
To download the VNP03IMG file, click on the provided link. The next 5 steps demonstrate how to obtain the match VNP03IMG file for a specific day.
https://drive.google.com/file/d/1cgZKa5LtP2Ba_OprFPrAEr1x7PnoCYxH/view?usp=sharing
root = '/Volumes/HD2/Datasets/Research'
VNP03IMG_Files = glob.glob('{}/NASA/Suomi-NPP/VIIRS/VNP03IMG/2019/2019_08_03/*.nc'.format(root))
len(VNP03IMG_Files)
VNP03IMG_Files[:10]
[i for i in VNP03IMG_Files if time_stamp in i]
VNP03IMG_filename = [i for i in VNP03IMG_Files if time_stamp in i][0]
f = netCDF4.Dataset(VNP03IMG_filename)
geo_data_gp = f.groups['geolocation_data']
df = pd.DataFrame()
for variable in ['latitude','longitude']:
masked_data = geo_data_gp.variables[variable]
data = ma.getdata(masked_data)
df[variable] = data.ravel()
granule_min_long = df['longitude'].min()
granule_max_long = df['longitude'].max()
granule_min_lat = df['latitude'].min()
granule_max_lat = df['latitude'].max()
print(granule_min_long,granule_max_long)
print(granule_min_lat,granule_max_lat)
df = pd.DataFrame()
for variable in ['latitude','longitude']:
masked_data = geo_data_gp.variables[variable]
data = ma.getdata(masked_data)
df[variable] = data.ravel()
sds_shape = frp_mask_data.shape
df['fire mask'] = frp_mask_data.ravel()
df
df_no_bowtie = df[ df['fire mask'] > 1 ]
df_no_bowtie
df_no_bowtie[['longitude','latitude']].to_numpy()
xy1_igrid = df_no_bowtie[['longitude','latitude']].to_numpy()
xy1_igrid.shape
df_no_bowtie[['fire mask']].to_numpy()
z_igrid_01 = df_no_bowtie[['fire mask']].to_numpy()
z_igrid_01.shape
z_igrid_01 = z_igrid_01.astype('float64')
z_igrid_01
%%time
xi, yi = np.mgrid[granule_min_long:granule_max_long:1000j, granule_min_lat:granule_max_lat:1000j]
z_01 = griddata(xy1_igrid, z_igrid_01, (xi, yi), method='nearest')
#----------#
THRESHOLD = 0.05
tree = cKDTree(xy1_igrid)
arr_x = _ndim_coords_from_arrays((xi, yi))
dists, indexes = tree.query(arr_x)
z_01[dists > THRESHOLD] = np.nan
#----------#
whereAreNaNs = np.isnan(z_01);
z_01[whereAreNaNs] = 0.;
min_long = granule_min_long
max_long = granule_max_long
min_lat = granule_min_lat
max_lat = granule_max_lat
plt.figure(figsize=(12,12),dpi=200, facecolor='w')
proj = ccrs.PlateCarree()
offset = 0.0
ease_extent = [min_long-offset,
max_long+offset,
min_lat-offset,
max_lat+offset]
ax = plt.axes(projection=proj)
ax.set_extent(ease_extent, crs=proj)
swe_extent = [min_long, max_long, min_lat, max_lat]
cmap = cm.get_cmap('RdBu_r', 11) # PiYG
color_list = ['#808080']
for i in range(cmap.N):
rgba = cmap(i)
color_list.append(matplotlib.colors.rgb2hex(rgba))
cmap = color_list
cmap = mpl.colors.ListedColormap(cmap)
bounds = [i for i in range(11)]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
im = ax.imshow(np.rot90(np.fliplr(z_01)), extent=swe_extent, transform=proj, origin='lower', aspect=1., cmap=cmap, norm=norm)
cbar_bounds = bounds
cbar_ticks = [(cbar_bounds[i+1]-cbar_bounds[i])/2.0+cbar_bounds[i] for i in range( len(cbar_bounds) - 1 )] # [0.5, 1.5, 155.0, 254.0, 255.0]
cbar_labels = [i for i in range(10)]
cbar = plt.colorbar(im, cmap=cmap, norm=norm, boundaries=cbar_bounds, ticks=cbar_ticks,fraction=0.020)
cbar.ax.set_yticklabels(cbar_labels, fontsize=10)
g1 = ax.gridlines(draw_labels=True, color='gray', linestyle='--')
ax.coastlines()
#plt.title('FIREX-AQ MASTER \n Fire Radiative Power (MW) \n {}-{}-{} {}:{} \n FRP TOT {:.2f}MW'.format(year,month,day,hour,minute,FRP_tot),fontsize=14)
g1.top_labels = False
g1.right_labels = False
plt.tight_layout()
plt.title('')
plt.savefig('NASA_VIIRS_AF_Remapping.png', dpi=1000, bbox_inches='tight')
plt.show()
plt.close()
I am sharing my initial attempt at VIIRS remapping, which involves going through various sections of a VIIRS granule. While this approach is not as efficient as the one explained above, I have included it as an additional example.
df = pd.DataFrame()
for variable in ['latitude','longitude']:
masked_data = geo_data_gp.variables[variable]
data = ma.getdata(masked_data)
data = data[:,(agg_y1+agg_y2)*2:(agg_y1+agg_y2+2*agg_y3)*2]
df[variable] = data.ravel()
sds_shape = data_img_03.shape
df['fire mask'] = data_img_03.ravel()
df
#min_long = df['longitude'].min()
#max_long = df['longitude'].max()
#min_lat = df['latitude'].min()
#max_lat = df['latitude'].max()
min_long = granule_min_long
max_long = granule_max_long
min_lat = granule_min_lat
max_lat = granule_max_lat
#print(min_long,max_long)
#print(min_lat,max_lat)
proj = ccrs.PlateCarree()
lat_long_grid = proj.transform_points(
x = df['longitude'].to_numpy().reshape(sds_shape),
y = df['latitude'].to_numpy().reshape(sds_shape),
src_crs = proj)
x_igrid = lat_long_grid[:,:,0] ## long
y_igrid = lat_long_grid[:,:,1] ## lat
z_igrid_01 = np.zeros(sds_shape)
z_igrid_01[:,:] = df['fire mask'].to_numpy().reshape(sds_shape)
x1_igrid = x_igrid.ravel()
y1_igrid = y_igrid.ravel()
z_igrid_01 = z_igrid_01.ravel()
xy1_igrid = np.vstack((x1_igrid, y1_igrid)).T
print( xy1_igrid.shape )
print( z_igrid_01.shape )
xy1_igrid
z_igrid_01
proj = ccrs.PlateCarree()
lat_long_grid = proj.transform_points(
x = df['longitude'].to_numpy().reshape(sds_shape),
y = df['latitude'].to_numpy().reshape(sds_shape),
src_crs = proj)
x_igrid = lat_long_grid[:,:,0] ## long
y_igrid = lat_long_grid[:,:,1] ## lat
#print(x_igrid.shape)
#----------#
z_igrid_01 = np.zeros(sds_shape)
z_igrid_01[:,:] = df['fire mask'].to_numpy().reshape(sds_shape)
x1_igrid = x_igrid.ravel()
y1_igrid = y_igrid.ravel()
z_igrid_01 = z_igrid_01.ravel()
xy1_igrid = np.vstack((x1_igrid, y1_igrid)).T
xi, yi = np.mgrid[min_long:max_long:1000j, min_lat:max_lat:1000j]
z_01 = griddata(xy1_igrid, z_igrid_01, (xi, yi), method='nearest')
#----------#
THRESHOLD = 0.05
tree = cKDTree(xy1_igrid)
arr_x = _ndim_coords_from_arrays((xi, yi))
dists, indexes = tree.query(arr_x)
z_01[dists > THRESHOLD] = np.nan
#----------#
whereAreNaNs = np.isnan(z_01);
z_01[whereAreNaNs] = 0.;
plt.figure(figsize=(12,12),dpi=200)
proj = ccrs.PlateCarree()
offset = 0.0
ease_extent = [min_long-offset,
max_long+offset,
min_lat-offset,
max_lat+offset]
ax = plt.axes(projection=proj)
ax.set_extent(ease_extent, crs=proj)
swe_extent = [min_long, max_long, min_lat, max_lat]
cmap = cm.get_cmap('RdBu_r', 11) # PiYG
color_list = ['#808080']
for i in range(cmap.N):
rgba = cmap(i)
color_list.append(matplotlib.colors.rgb2hex(rgba))
cmap = color_list
cmap = mpl.colors.ListedColormap(cmap)
bounds = [i for i in range(11)]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
im = ax.imshow(np.rot90(np.fliplr(z_01)), extent=swe_extent, transform=proj, origin='lower', aspect=1., cmap=cmap, norm=norm)
cbar_bounds = bounds
cbar_ticks = [(cbar_bounds[i+1]-cbar_bounds[i])/2.0+cbar_bounds[i] for i in range( len(cbar_bounds) - 1 )] # [0.5, 1.5, 155.0, 254.0, 255.0]
cbar_labels = [i for i in range(10)]
cbar = plt.colorbar(im, cmap=cmap, norm=norm, boundaries=cbar_bounds, ticks=cbar_ticks,fraction=0.026)
cbar.ax.set_yticklabels(cbar_labels, fontsize=10)
g1 = ax.gridlines(draw_labels=True, color='gray', linestyle='--')
ax.coastlines()
#plt.title('FIREX-AQ MASTER \n Fire Radiative Power (MW) \n {}-{}-{} {}:{} \n FRP TOT {:.2f}MW'.format(year,month,day,hour,minute,FRP_tot),fontsize=14)
g1.top_labels = False
g1.right_labels = False
plt.tight_layout()
plt.title('')
#plt.savefig('./outputs/FIREX_AQ_MASTER_FRP_Regridding_{}{}{}_{}{}.png'.format(year,month,day,hour,minute), dpi=100, bbox_inches='tight')
plt.show()
plt.close()
data_img_03_z = z_01.copy()
df = pd.DataFrame()
for variable in ['latitude','longitude']:
masked_data = geo_data_gp.variables[variable]
data = ma.getdata(masked_data)
data = data[:,0:agg_y1*2]
df[variable] = data.ravel()
sds_shape = data_img_01.shape
df['fire mask'] = data_img_01.ravel()
df
df['fire mask'].value_counts()
df = df[ df['fire mask'] != 1 ]
df.shape
print( data_img_01.shape )
print( data_img_01[ data_img_01 == 1 ].shape )
data_img_01[ data_img_01 == 1 ]
data_img_01[ data_img_01[:,-1] != 1 ].shape
data_img_01[ data_img_01[:,-1] != 1 ]
data_img_01_no_bowtie = ma.getdata(data_img_01[ data_img_01[:,-1] != 1 ])
data_img_01_no_bowtie
sds_shape = data_img_01_no_bowtie.shape
sds_shape
4872 * 1280
plot_fire_mask(data_img_01_no_bowtie,filename,show_plot=True,dpi=200,nb_ticks=5)
#min_long = df['longitude'].min()
#max_long = df['longitude'].max()
#min_lat = df['latitude'].min()
#max_lat = df['latitude'].max()
#print(min_long,max_long)
#print(min_lat,max_lat)
proj = ccrs.PlateCarree()
lat_long_grid = proj.transform_points(
x = df['longitude'].to_numpy().reshape(sds_shape),
y = df['latitude'].to_numpy().reshape(sds_shape),
src_crs = proj)
x_igrid = lat_long_grid[:,:,0] ## long
y_igrid = lat_long_grid[:,:,1] ## lat
#print(x_igrid.shape)
#----------#
z_igrid_01 = np.zeros(sds_shape)
z_igrid_01[:,:] = df['fire mask'].to_numpy().reshape(sds_shape)
x1_igrid = x_igrid.ravel()
y1_igrid = y_igrid.ravel()
z_igrid_01 = z_igrid_01.ravel()
xy1_igrid = np.vstack((x1_igrid, y1_igrid)).T
xi, yi = np.mgrid[granule_min_long:granule_max_long:1000j, granule_min_lat:granule_max_lat:1000j]
z_01 = griddata(xy1_igrid, z_igrid_01, (xi, yi), method='nearest')
#----------#
THRESHOLD = 0.05
tree = cKDTree(xy1_igrid)
arr_x = _ndim_coords_from_arrays((xi, yi))
dists, indexes = tree.query(arr_x)
z_01[dists > THRESHOLD] = np.nan
#----------#
whereAreNaNs = np.isnan(z_01);
z_01[whereAreNaNs] = 0.;
plt.figure(figsize=(12,12),dpi=200)
proj = ccrs.PlateCarree()
offset = 0.0
ease_extent = [min_long-offset,
max_long+offset,
min_lat-offset,
max_lat+offset]
ax = plt.axes(projection=proj)
ax.set_extent(ease_extent, crs=proj)
swe_extent = [min_long, max_long, min_lat, max_lat]
cmap = cm.get_cmap('RdBu_r', 11) # PiYG
color_list = ['#808080']
for i in range(cmap.N):
rgba = cmap(i)
color_list.append(matplotlib.colors.rgb2hex(rgba))
cmap = color_list
cmap = mpl.colors.ListedColormap(cmap)
bounds = [i for i in range(11)]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
im = ax.imshow(np.rot90(np.fliplr(z_01)), extent=swe_extent, transform=proj, origin='lower', aspect=1., cmap=cmap, norm=norm)
cbar_bounds = bounds
cbar_ticks = [(cbar_bounds[i+1]-cbar_bounds[i])/2.0+cbar_bounds[i] for i in range( len(cbar_bounds) - 1 )] # [0.5, 1.5, 155.0, 254.0, 255.0]
cbar_labels = [i for i in range(10)]
cbar = plt.colorbar(im, cmap=cmap, norm=norm, boundaries=cbar_bounds, ticks=cbar_ticks,fraction=0.020)
cbar.ax.set_yticklabels(cbar_labels, fontsize=10)
g1 = ax.gridlines(draw_labels=True, color='gray', linestyle='--')
ax.coastlines()
#plt.title('FIREX-AQ MASTER \n Fire Radiative Power (MW) \n {}-{}-{} {}:{} \n FRP TOT {:.2f}MW'.format(year,month,day,hour,minute,FRP_tot),fontsize=14)
g1.top_labels = False
g1.right_labels = False
plt.tight_layout()
plt.title('')
#plt.savefig('./outputs/FIREX_AQ_MASTER_FRP_Regridding_{}{}{}_{}{}.png'.format(year,month,day,hour,minute), dpi=100, bbox_inches='tight')
plt.show()
plt.close()
data_img_01_z = z_01.copy()
plt.figure(figsize=(12,12),dpi=200)
proj = ccrs.PlateCarree()
offset = 0.0
ease_extent = [min_long-offset,
max_long+offset,
min_lat-offset,
max_lat+offset]
ax = plt.axes(projection=proj)
ax.set_extent(ease_extent, crs=proj)
swe_extent = [min_long, max_long, min_lat, max_lat]
cmap = cm.get_cmap('RdBu_r', 11) # PiYG
color_list = ['#808080']
for i in range(cmap.N):
rgba = cmap(i)
color_list.append(matplotlib.colors.rgb2hex(rgba))
cmap = color_list
cmap = mpl.colors.ListedColormap(cmap)
bounds = [i for i in range(11)]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
im = ax.imshow(np.rot90(np.fliplr(data_img_01_z+data_img_03_z)), extent=swe_extent, transform=proj, origin='lower', aspect=1., cmap=cmap, norm=norm)
cbar_bounds = bounds
cbar_ticks = [(cbar_bounds[i+1]-cbar_bounds[i])/2.0+cbar_bounds[i] for i in range( len(cbar_bounds) - 1 )] # [0.5, 1.5, 155.0, 254.0, 255.0]
cbar_labels = [i for i in range(10)]
cbar = plt.colorbar(im, cmap=cmap, norm=norm, boundaries=cbar_bounds, ticks=cbar_ticks,fraction=0.020)
cbar.ax.set_yticklabels(cbar_labels, fontsize=10)
g1 = ax.gridlines(draw_labels=True, color='gray', linestyle='--')
ax.coastlines()
#plt.title('FIREX-AQ MASTER \n Fire Radiative Power (MW) \n {}-{}-{} {}:{} \n FRP TOT {:.2f}MW'.format(year,month,day,hour,minute,FRP_tot),fontsize=14)
g1.top_labels = False
g1.right_labels = False
plt.tight_layout()
plt.title('')
#plt.savefig('./outputs/FIREX_AQ_MASTER_FRP_Regridding_{}{}{}_{}{}.png'.format(year,month,day,hour,minute), dpi=100, bbox_inches='tight')
plt.show()
plt.close()
res_z = []
for i in range(5):
data_img = imgs_list[i]
df = pd.DataFrame()
for variable in ['latitude','longitude']:
masked_data = geo_data_gp.variables[variable]
data = ma.getdata(masked_data)
data = data[:,idx_bounds[i]:idx_bounds[i+1]]
df[variable] = data.ravel()
sds_shape = data_img.shape
df['fire mask'] = data_img.ravel()
df = df[ df['fire mask'] != 1 ]
data_img_no_bowtie = ma.getdata(data_img[ data_img[:,-1] != 1 ])
sds_shape = data_img_no_bowtie.shape
proj = ccrs.PlateCarree()
lat_long_grid = proj.transform_points(
x = df['longitude'].to_numpy().reshape(sds_shape),
y = df['latitude'].to_numpy().reshape(sds_shape),
src_crs = proj)
x_igrid = lat_long_grid[:,:,0] ## long
y_igrid = lat_long_grid[:,:,1] ## lat
#print(x_igrid.shape)
#----------#
z_igrid_01 = np.zeros(sds_shape)
z_igrid_01[:,:] = df['fire mask'].to_numpy().reshape(sds_shape)
x1_igrid = x_igrid.ravel()
y1_igrid = y_igrid.ravel()
z_igrid_01 = z_igrid_01.ravel()
xy1_igrid = np.vstack((x1_igrid, y1_igrid)).T
xi, yi = np.mgrid[granule_min_long:granule_max_long:1000j, granule_min_lat:granule_max_lat:1000j]
z_01 = griddata(xy1_igrid, z_igrid_01, (xi, yi), method='nearest')
#----------#
THRESHOLD = 0.05
tree = cKDTree(xy1_igrid)
arr_x = _ndim_coords_from_arrays((xi, yi))
dists, indexes = tree.query(arr_x)
z_01[dists > THRESHOLD] = np.nan
#----------#
whereAreNaNs = np.isnan(z_01);
z_01[whereAreNaNs] = 0.;
plt.figure(figsize=(12,12),dpi=200)
proj = ccrs.PlateCarree()
offset = 0.0
ease_extent = [min_long-offset,
max_long+offset,
min_lat-offset,
max_lat+offset]
ax = plt.axes(projection=proj)
ax.set_extent(ease_extent, crs=proj)
swe_extent = [min_long, max_long, min_lat, max_lat]
cmap = cm.get_cmap('RdBu_r', 11) # PiYG
color_list = ['#808080']
for i in range(cmap.N):
rgba = cmap(i)
color_list.append(matplotlib.colors.rgb2hex(rgba))
cmap = color_list
cmap = mpl.colors.ListedColormap(cmap)
bounds = [i for i in range(11)]
norm = mpl.colors.BoundaryNorm(bounds, cmap.N)
im = ax.imshow(np.rot90(np.fliplr(z_01)), extent=swe_extent, transform=proj, origin='lower', aspect=1., cmap=cmap, norm=norm)
cbar_bounds = bounds
cbar_ticks = [(cbar_bounds[i+1]-cbar_bounds[i])/2.0+cbar_bounds[i] for i in range( len(cbar_bounds) - 1 )] # [0.5, 1.5, 155.0, 254.0, 255.0]
cbar_labels = [i for i in range(10)]
cbar = plt.colorbar(im, cmap=cmap, norm=norm, boundaries=cbar_bounds, ticks=cbar_ticks,fraction=0.020)
cbar.ax.set_yticklabels(cbar_labels, fontsize=10)
g1 = ax.gridlines(draw_labels=True, color='gray', linestyle='--')
ax.coastlines()
#plt.title('FIREX-AQ MASTER \n Fire Radiative Power (MW) \n {}-{}-{} {}:{} \n FRP TOT {:.2f}MW'.format(year,month,day,hour,minute,FRP_tot),fontsize=14)
g1.top_labels = False
g1.right_labels = False
plt.tight_layout()
plt.title('')
#plt.savefig('./outputs/FIREX_AQ_MASTER_FRP_Regridding_{}{}{}_{}{}.png'.format(year,month,day,hour,minute), dpi=100, bbox_inches='tight')
plt.show()
plt.close()
print('Done')
data_img_z = z_01.copy()
res_z.append(data_img_z)