Page 1 of 1

Plotting CYGNSS Level 2 Ocean Surface Heat Flux

Posted: 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!

Re: Plotting CYGNSS Level 2 Ocean Surface Heat Flux

Posted: 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

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.savefig("cygnss_lhf.png")

cygnss_lhf.png (228.92 KiB) Viewed 15099 times

Regards,

PODAAC DE