This is the demonstration how to use NEDO data process utility
In [1]:
%load_ext autoreload
%autoreload 2
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
from pypvcell.solarcell import SQCell,MJCell,TransparentCell
from pypvcell.illumination import Illumination
from pypvcell.spectrum import Spectrum
from pypvcell.metpv_reader import NEDOLocation
from pvlib.location import Location
from pvlib.tracking import SingleAxisTracker
from pvlib.irradiance import total_irrad,aoi_projection
In [2]:
nedo_solar_file='hm51106year.csv'
In [3]:
ngo_loc=NEDOLocation(nedo_solar_file)
df=ngo_loc.main_df
In [4]:
ngo_loc.main_df.head()
Out[4]:
main_df adds the column names into the raw data and convert it to a pandas.DataFrame object
In [5]:
%%time
ngo_df=ngo_loc.extract_unstack_hour_data(norm=False)
In [6]:
ngo_df.head()
Out[6]:
In [7]:
ngo_df.to_csv("ngo_df.csv")
In [8]:
ngo_df[['GHI','DHI','dHI']].sum()
Out[8]:
In [9]:
ngo_dni=ngo_loc.get_DNI()
In [10]:
ngo_dni.head()
Out[10]:
In [11]:
plt.plot(ngo_dni)
plt.ylim([0,1000])
Out[11]:
In [12]:
ngo_tilt_irr=ngo_loc.tilt_irr(include_solar_pos=True)
In [13]:
ngo_tilt_irr.head()
Out[13]:
In [14]:
ngo_tilt_irr.columns
Out[14]:
In [15]:
plt.plot(ngo_tilt_irr['poa_direct'],alpha=0.5,label='incidence on tilt surface')
plt.plot(ngo_dni,alpha=0.5,label='DNI')
plt.ylim([0,1000])
plt.legend()
Out[15]:
In [16]:
from matplotlib.colors import LogNorm
filtered_df=ngo_tilt_irr.loc[(ngo_tilt_irr['poa_direct']>1) & (ngo_tilt_irr['poa_direct']<500),
["azimuth","zenith",'poa_direct']]
ax = plt.subplot(111, projection='polar')
ax.plot(filtered_df['azimuth'].values*np.pi/180-np.pi/2,
filtered_df['zenith'].values-ngo_loc.latitude,'.')
plt.show()
In [17]:
import matplotlib as mpl
filtered_df=ngo_tilt_irr.loc[(ngo_tilt_irr['poa_direct']>1) & (ngo_tilt_irr['poa_direct']<500),
["azimuth","zenith",'poa_direct']]
ax = plt.subplot(111, projection='polar')
colormap = plt.get_cmap('hsv')
norm = mpl.colors.Normalize(1, 400)
cax=ax.scatter(filtered_df['azimuth'].values*np.pi/180-np.pi/2, filtered_df['zenith'].values-ngo_loc.latitude,
c=filtered_df['poa_direct'].values,s=200,norm=norm,alpha=0.5)
plt.colorbar(cax)
plt.savefig("nagoya_angular.png",dpi=600)
plt.show()
In [18]:
ngo_tilt_irr.columns
Out[18]:
In [19]:
plt.hist(ngo_tilt_irr['aoi'],weights=ngo_tilt_irr['poa_direct'],bins=100)
plt.show()
In [ ]: