In [1]:
%run basics
import pysolar
In [2]:
# get the netCDF file name
ncname = qcio.get_filename_dialog(path="../../Sites")
In [3]:
# read the netCDF file contents into the data structure
ds = qcio.nc_read_series(ncname)
In [4]:
# calculate the synthetic incoming shortwave radiation
qcts.get_synthetic_fsd(ds)
In [4]:
# get the necessary data from the data structure
dt = ds.series["DateTime"]["Data"]
Fsd,f,a = qcutils.GetSeriesasMA(ds,"Fsd")
Fsd_syn,f,a = qcutils.GetSeriesasMA(ds,"Fsd_syn")
Fsd_filtered,f,a = qcutils.GetSeriesasMA(ds,"Fsd_filtered")
Fc,f,a = qcutils.GetSeriesasMA(ds,"Fc")
ustar,f,a = qcutils.GetSeriesasMA(ds,"ustar")
Hour,f,a = qcutils.GetSeriesasMA(ds,"Hour")
sa,f,a = qcutils.GetSeriesasMA(ds,"solar_altitude")
In [10]:
fig=plt.figure()
plt.plot(dt,sa,'b.')
plt.show()
In [6]:
# plot a figure of the observed and synthetic incoming shortwave radiation
fig=plt.figure()
plt.plot(dt,Fsd,'b.')
plt.plot(dt,Fsd_syn,'ro')
plt.show()
In [7]:
# first, filter using Fsd and ustar only
index = numpy.ma.where((Fsd<10)&(ustar>0.25))[0]
ldt = [dt[i] for i in index]
Fc_nu = Fc[index]
Hour_nu = Hour[index]
q = numpy.percentile(Fc[index],[2.5,97.5])
print q
Fc_nuq = numpy.ma.masked_where((Fc_nu<q[0])|(Fc_nu>q[1]),Fc_nu)
In [8]:
# and plot the results
fig=plt.figure()
plt.subplot(211)
plt.plot(ldt,Fc_nu,'b.')
plt.plot(ldt,Fc_nuq,'r+')
plt.subplot(212)
plt.plot(ldt,Hour_nu,'ro')
plt.show()
In [9]:
# now filter using Fsd, Fsd_syn and ustar
index = numpy.ma.where((Fsd<10)&(Fsd_syn<10)&(ustar>0.25))[0]
ldt = [dt[i] for i in index]
Fc_nu = Fc[index]
Hour_nu = Hour[index]
q = numpy.percentile(Fc[index],[2.5,97.5])
print q
Fc_nuq = numpy.ma.masked_where((Fc_nu<q[0])|(Fc_nu>q[1]),Fc_nu)
In [11]:
# and plot the results
fig=plt.figure()
plt.subplot(211)
plt.plot(ldt,Fc_nu,'b.')
plt.plot(ldt,Fc_nuq,'r+')
plt.subplot(212)
plt.plot(ldt,Hour_nu,'ro')
plt.show()
In [5]:
fig=plt.figure()
plt.plot(dt,Fsd_filtered,'b.')
plt.show()
In [ ]: