Plotting CYGNSS Level 2 Ocean Surface Heat Flux

Plotting CYGNSS Level 2 Ocean Surface Heat Flux

Postby gr4fitt3 » Sun Aug 11, 2019 8:30 pm

Hello!

I'm trying to plot on Jupyter Notebook a latent heat flux map with CYGNSS L2 data, but without sucess.
Could someone send me a python script example to do this?

Thank you!
gr4fitt3
 
Posts: 1
Joined: Sun Aug 11, 2019 7:49 pm

Re: Plotting CYGNSS Level 2 Ocean Surface Heat Flux

Postby yiboj » Mon Aug 12, 2019 2:28 pm

Hi,
Thanks for the inquiry, here is the python script used to read and create the global map of surface heat flux.

Code: Select all
from matplotlib import pyplot as plt
from mpl_toolkits.basemap import Basemap
from netCDF4 import Dataset
import matplotlib

# read data
filename = 'cyg.ddmi.s20190101-000000-e20190101-235959.l2.surface-flux.a10.d10.nc'

print(filename)
ncin = Dataset(filename, 'r')
lon = ncin.variables['lon'][::10]
lat = ncin.variables['lat'][::10]
data = ncin.variables['lhf'][::10]
ncin.close()

# setup figure object
fig = plt.figure(figsize=(6, 3.375), dpi=200)

# set up map projection
m = Basemap(projection='moll',lon_0=0,resolution='c')
m.bluemarble()

xpt,ypt = m(lon,lat)

cs=m.scatter(xpt, ypt, c=data, cmap=plt.cm.jet, vmin=20, vmax=350, marker="s", facecolors="None", s=0.25)

cb = m.colorbar(cs, 'right', size='2%', pad='0.5%')
cb.ax.set_yticklabels(cb.ax.get_yticklabels(), fontsize=6)
cb.set_label('Latent heat flux (W m-2)', fontsize=7,fontweight="bold")
cb.set_ticks(range(20,350,100))

plt.suptitle("CYGNSS Level 2 V1.0", fontsize=8, fontweight="bold")
plt.subplots_adjust(left=0.02, right=0.92, top=0.98, bottom=0.01)
plt.savefig("cygnss_lhf.png")


cygnss_lhf.png
cygnss_lhf.png (228.92 KiB) Viewed 151 times


Regards,

PODAAC DE
yiboj
 
Posts: 88
Joined: Mon Mar 30, 2015 11:22 am


Return to Data Recipes

cron