pythonpvlibsolar

PVLib Forecast not adjusting for timezone


Background

I'm attempting to produce a forecast of solar power using PVLib. I've followed all the instructions on the ReadTheDocs Page and am able to run through the query without issue and produce an output.

Problem

I've specified the timezone 'Australia/Queensland' (+10), however when I look at the export of forecast data, it doesn't appear as if the GFS data has been adjusted for timezone. The Air-Temp and short-wave flux fields in the raw data export still seem to be in UTC time.

Even when I run the 'process_data' class, the air-temp still appears to be incorrect. The calculated irradiance fields (ghi, dni, dhi) appear to line up correctly with timezone, however since these are calculated fields based on cloud cover & solar position, I don't know if they actually used the right inputs.

Requested Help

Anyone know what the issue might be? have I overlooked something, is this a mistake in PVLib, or do I need to adjust for timezone manually before running the process_data class? I've attached my code below if that helps.

# **********************************************************
# PACKAGES
# **********************************************************
import pandas as pd
from datetime import date

from pvlib.tracking import SingleAxisTracker
from pvlib.modelchain import ModelChain
from pvlib.temperature import TEMPERATURE_MODEL_PARAMETERS
from pvlib.forecast import GFS

# **********************************************************
# INPUTS
# **********************************************************
latitude = -27.5
longitude = 153.00
tz = 'Australia/Queensland'
start = pd.Timestamp(date.today(), tz=tz)
end = start + pd.Timedelta(days=7)
dc_size = 110
ac_size = 100
module_parameters = {'pdc0': dc_size, 'gamma_pdc': -0.004}
inverter_parameters = {'pdc': ac_size, 'pdc0': dc_size, 'eta_inv_nom': dc_size / ac_size}
temperature_model_parameters = TEMPERATURE_MODEL_PARAMETERS['sapm']['open_rack_glass_glass']

# **********************************************************
# GFS
# **********************************************************
model = GFS(resolution='Quarter')
raw_data = model.get_data(latitude, longitude, start, end)
raw_data.to_csv('raw_gfs_data.csv')

data = model.get_processed_data(latitude, longitude, start, end)
data.to_csv('processed_gfs_data.csv')

# Resample data
resampled_data = data.resample('30min').interpolate()

# **********************************************************
# PV SYSTEM
# **********************************************************
# Define the specs for the PV System (horizontal axis tracking system)
t_system = SingleAxisTracker(
    axis_azimuth=90, axis_tilt=0, max_angle=180, backtrack=True, module='pvwatts_dc', inverter='pvwatts_ac',
    module_parameters=module_parameters,inverter_parameters=inverter_parameters, name='tracking', gcr=.40,
    temperature_model_parameters=temperature_model_parameters
)

# build model chain
mc = ModelChain(
    system=t_system, location=model.location, name='pvwatts', dc_model='pvwatts', ac_model='pvwatts', 
    aoi_model='physical', spectral_model='no_loss', temperature_model='sapm', losses_model='no_loss',
    transposition_model='perez'
)

# Run model, Export AC Power
mc.run_model(resampled_data)
ac = mc.ac
ac.to_csv('export_ac.csv')

Solution

  • The data returned by the thredds server is always in UTC, and pvlib makes no attempt to localize it based on the timezone of the input start or end parameters. You can adjust the timezone of the raw or the processed data: data = data.tz_convert(tz)