sup3r icon indicating copy to clipboard operation
sup3r copied to clipboard

Unrealistic clearsky ratio scenes at night

Open grantbuster opened this issue 6 months ago • 0 comments

Seeing weird clearsky ratio scenes at night in timesteps 12-14 where left is clearsky ratio, right is ghi. Timesteps with all(ghi < 10) are being caught at dawn/dusk and making really weird clearsky ratio scenes at night. Would be a good experiment to set timesteps where all(cs_ghi < 10) = np.nan to try and get rid of these weird cs ratio scenes.

image

Code to reproduce based on tests/batch_handlers/test_bh_h5_cc.py

"""pytests for H5 climate change data batch handlers"""

import os
import matplotlib.pyplot as plt
import numpy as np
import pytest

from sup3r.preprocessing import (
    BatchHandlerCC,
    DataHandlerH5SolarCC,
    DataHandlerH5WindCC,
)
from sup3r.preprocessing.utilities import numpy_if_tensor
from sup3r.utilities.pytest.helpers import BatchHandlerTesterCC

SHAPE = (20, 20)
FEATURES_S = ['clearsky_ratio', 'ghi', 'clearsky_ghi']
TARGET_S = (39.01, -105.13)
FEATURES_W = ['u_100m', 'v_100m', 'temperature_100m']
TARGET_W = (39.01, -105.15)
TARGET_SURF = (39.1, -105.4)

dh_kwargs = {
    'target': TARGET_S,
    'shape': SHAPE,
    'time_slice': slice(None, None, 2),
    # 'time_roll': -7,
}
from sup3r import CONFIG_DIR, TEST_DATA_DIR
FP_NSRDB = os.path.join(TEST_DATA_DIR, 'test_nsrdb_co_2018.h5')

test = np.asarray(handler.data.hourly[:, :, 816:888])

for idt in range(36):
    fig, ax = plt.subplots(1, 2, figsize=(15, 5))
    for idf in range(test.shape[-1]):
        a = ax[idf].imshow(test[:, :, idt, idf])
        plt.colorbar(a, ax=ax[idf])
    plt.title(idt)
    plt.show()
    plt.close()

grantbuster avatar Aug 05 '24 22:08 grantbuster