Skip to content

Commit

Permalink
fix file opens
Browse files Browse the repository at this point in the history
  • Loading branch information
cwhanse committed Apr 8, 2024
1 parent 096d480 commit bfe3642
Show file tree
Hide file tree
Showing 5 changed files with 1,027 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

"""
Quantifying the effects of snow cover
=====================================
Expand Down Expand Up @@ -38,7 +37,6 @@
#%% Import packages

import pathlib
import os
import json
import pandas as pd
import numpy as np
Expand All @@ -48,22 +46,21 @@
from matplotlib.dates import DateFormatter
import matplotlib.patches as mpatches
from matplotlib.lines import Line2D
from pvanalytics.features import clipping

import pvanalytics
# Functions needed for the analysis procedure
from pvanalytics.features import clipping
from pvanalytics.snow import (get_irradiance_sapm, get_irradiance_imp,
get_transmission, categorize, apply_mask)

# %% Load in system configuration parameters (dict)
pvanalytics_dir = pathlib.Path(pvanalytics.__file__).parent
data_file = pvanalytics_dir / 'data' / 'snow_data.csv'
snowfall_file = pvanalytics_dir / 'data' / 'snow_snowfall.csv'
mask_file = pvanalytics_dir / 'data' / 'snow_mask.csv'
config_file = pvanalytics_dir / 'data' / 'snowconfig.json'

base_dir = pathlib.Path('.')
data_dir = os.path.join(base_dir, 'data')
data_path = os.path.join(data_dir, 'data.csv')
snow_path = os.path.join(data_dir, 'snow.csv')
mask_path = os.path.join(data_dir, 'mask.csv')
config_path = os.path.join(data_dir, 'config.json')

with open(config_path) as json_data:
with open(config_file) as json_data:
config = json.load(json_data)

#%% Retrieve and print system inverter specs and electrical configuration
Expand Down Expand Up @@ -91,7 +88,7 @@
# by an electric utility.

# Load in utility data
data = pd.read_csv(data_path, index_col='Timestamp')
data = pd.read_csv(data_file, index_col='Timestamp')
data.set_index(pd.DatetimeIndex(data.index,ambiguous='infer'), inplace=True)
data = data[~data.index.duplicated()]

Expand Down Expand Up @@ -215,7 +212,7 @@
'''

horizon_mask = pd.read_csv(mask_path,
horizon_mask = pd.read_csv(mask_file,
index_col='Unnamed: 0').squeeze("columns")

data.loc[:, 'Horizon Mask'] = data.apply(lambda x: apply_mask(
Expand Down Expand Up @@ -682,7 +679,7 @@ def wrapper(voltage, current, temp_cell, effective_irradiance,
# four modes that are associated with the presence of snow.

# Daily snowfall is measured at 7:00 am of each day
snow = pd.read_csv(snow_path, index_col='DATE') # originally in [mm]
snow = pd.read_csv(snowfall_file, index_col='DATE') # originally in [mm]
snow['SNOW'] *= 1/(10*2.54) # convert to [in]

loss_cols = [c for c in data.columns if "Loss" in c]
Expand Down
71 changes: 71 additions & 0 deletions pvanalytics/data/snow_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{ "panel": "REC_Solar_REC340TP_72_BLK",
"inverter" : "Yaskawa_Solectria_Solar__PVI_60TL_480__480V_",
"threshold_vratio" : 0.933,
"threshold_transmission" : 0.598,
"num_mods_per_str": {
"INV1 CB1": "18",
"INV1 CB2": "18",
"INV1 CB3": "18",
"INV2 CB1": "18",
"INV2 CB2": "18",
"INV2 CB3": "18",
"INV3 CB1": "18",
"INV3 CB2": "18",
"INV3 CB3": "18"
},
"num_str_per_cb": {
"INV1 CB1": "4",
"INV1 CB2": "4",
"INV1 CB3": "4",
"INV2 CB1": "4",
"INV2 CB2": "4",
"INV2 CB3": "4",
"INV3 CB1": "4",
"INV3 CB2": "4",
"INV3 CB3": "4"
},
"sapm_coeff": {
"Vintage": "2013",
"Area": 1.64,
"Material": "c-Si",
"Cells_in_Series": 72,
"Parallel_Strings": 1,
"Isco": 9.36992857142857,
"Voco": 46.78626811224489,
"Impo": 8.895117736670294,
"Vmpo": 37.88508962264151,
"Aisc": 0.0002,
"Aimp": -0.0004,
"C0": 1.0145,
"C1": -0.0145,
"Bvoco": -0.1205,
"Mbvoc": 0,
"Bvmpo": -0.1337,
"Mbvmp": 0,
"N": 1.0925,
"C2": -0.4647,
"C3": -11.900781,
"A0": 0.9731,
"A1": 0.02966,
"A2": -0.01024,
"A3": 0.001793,
"A4": -0.0001286,
"B0": 1,
"B1": -0.0154,
"B2": 0.001572,
"B3": -5.525e-05,
"B4": 8.04e-07,
"B5": -4.202e-09,
"DTC": 3.05,
"FD": 1,
"A": -3.4247,
"B": -0.0951,
"C4": NaN,
"C5": NaN,
"IXO": NaN,
"IXXO": NaN,
"C6": NaN,
"C7": NaN,
"Notes": "Source: CFV Solar Test Lab. Tested 2013. Module 13022-11"
}
}
Loading

0 comments on commit bfe3642

Please sign in to comment.