diff --git a/sup3r/cli.py b/sup3r/cli.py index b69ce58b3..9d19b1c66 100644 --- a/sup3r/cli.py +++ b/sup3r/cli.py @@ -479,18 +479,18 @@ def batch(ctx, dry_run, cancel, delete, monitor_background, verbose): config below, four sup3r pipelines will be created where arg1 and arg2 are set to [0, "a"], [0, "b"], [1, "a"], [1, "b"] in config_fwp.json:: - { - "pipeline_config": "./config_pipeline.json", - "sets": [ - { - "args": { - "arg1": [0, 1], - "arg2": ["a", "b"], - }, - "files": ["./config_fwp.json"], - "set_tag": "set1" - } - } + { + "pipeline_config": "./config_pipeline.json", + "sets": [ + { + "args": { + "arg1": [0, 1], + "arg2": ["a", "b"], + }, + "files": ["./config_fwp.json"], + "set_tag": "set1" + } + } Note that you can use multiple "sets" to isolate parameter permutations. """ diff --git a/sup3r/configs/solar_cc/README.rst b/sup3r/configs/solar_cc/README.rst deleted file mode 100644 index a44e8b40f..000000000 --- a/sup3r/configs/solar_cc/README.rst +++ /dev/null @@ -1,18 +0,0 @@ -********************************************************************************* -Spatiotemporal Super Resolving GAN configs for Solar Climate Change Applications -********************************************************************************* - -This directory saves example configs for spatiotemporal super resolving GAN -models based on the NSRDB for solar climate change applications. All generator -model configs should start with "gen_*" and should have two "4x" tags (4 for -example) that represents the spatial and temporal enhancements that the -generator is designed for respectively and one "3f" tag that represents the -number of output features. - -For example "gen_2x_24x_2f.json" is a model that would enhance a 4km daily -spatiotemporal field to 2km hourly with 2 output features. - -These configs are only examples and are not guaranteed to be the models used in -producing actual production datasets. For the final model architectures, see -the global file attributes associated with sup3r output h5 files which should -contain all model meta data. diff --git a/sup3r/configs/solar_cc/gen_10x_3x_1f.json b/sup3r/configs/solar_cc/gen_10x_3x_1f.json deleted file mode 100644 index 68c2879f6..000000000 --- a/sup3r/configs/solar_cc/gen_10x_3x_1f.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "hidden_layers": [ - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"alpha": 0.2, "class": "LeakyReLU"}, - {"class": "SpatioTemporalExpansion", "temporal_mult": 3, "temporal_method": "nearest"}, - {"class": "SkipConnection", "name": "big_skip"}, - - {"n": 16, "repeat": [ - {"class": "SkipConnection", "name": "small_skip"}, - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"alpha": 0.2, "class": "LeakyReLU"}, - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"class": "SkipConnection", "name": "small_skip"} - ] - }, - - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"class": "SkipConnection", "name": "big_skip"}, - - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 100, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"class": "SpatioTemporalExpansion", "spatial_mult": 5}, - {"alpha": 0.2, "class": "LeakyReLU"}, - - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 72, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"class": "SpatioTemporalExpansion", "spatial_mult": 2}, - {"alpha": 0.2, "class": "LeakyReLU"}, - - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 1, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1} - ] -} diff --git a/sup3r/configs/solar_cc/gen_2x_3x_1f.json b/sup3r/configs/solar_cc/gen_2x_3x_1f.json deleted file mode 100644 index 86151344b..000000000 --- a/sup3r/configs/solar_cc/gen_2x_3x_1f.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "hidden_layers": [ - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"alpha": 0.2, "class": "LeakyReLU"}, - {"class": "SpatioTemporalExpansion", "temporal_mult": 3, "temporal_method": "nearest"}, - {"class": "SkipConnection", "name": "big_skip"}, - - {"n": 16, "repeat": [ - {"class": "SkipConnection", "name": "small_skip"}, - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"alpha": 0.2, "class": "LeakyReLU"}, - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"class": "SkipConnection", "name": "small_skip"} - ] - }, - - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"class": "SkipConnection", "name": "big_skip"}, - - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 72, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1}, - {"class": "SpatioTemporalExpansion", "spatial_mult": 2}, - {"alpha": 0.2, "class": "LeakyReLU"}, - - {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 1, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 1} - ] -} diff --git a/sup3r/configs/sup3rcc/README.rst b/sup3r/configs/sup3rcc/README.rst new file mode 100644 index 000000000..9aafe7622 --- /dev/null +++ b/sup3r/configs/sup3rcc/README.rst @@ -0,0 +1,26 @@ +************************************************************************** +Spatiotemporal Super Resolving GAN configs for Climate Change Applications +************************************************************************** + +This directory saves example configs for spatiotemporal super resolving GAN +models for wind, solar, and temperature climate change data. All generator +model configs should start with "gen_*" and should have two "_4x" tags (4 for +example) that represents the spatial and temporal enhancements that the +generator is designed for respectively and one "_3f" tag that represents the +number of output features. + +For example "gen_2x_24x_2f.json" is a model that would enhance a 4km daily +spatiotemporal field to 2km hourly with 2 output features. + +Unique model designs are utilized for each unique variable set. For example, +when doing spatial super resolution of wind fields, a custom model with +mid-network topography injection via a "Sup3rConcat" layer is used. For wind +temporal super resolution, a 24x enhancement is used to go from daily to +hourly, but for solar an 8x enhancement is used to go from 3 days to 24 hours +of the middle day. Also, note that the "_trh_" model tag stands for temperature +and relative humidity. + +These configs are only examples and are not guaranteed to be the models used in +producing actual production datasets. For the final model architectures, see +the global file attributes associated with sup3r output h5 files which should +contain all model meta data. diff --git a/sup3r/configs/solar_cc/gen_1x_8x_1f.json b/sup3r/configs/sup3rcc/gen_solar_1x_8x_1f.json similarity index 86% rename from sup3r/configs/solar_cc/gen_1x_8x_1f.json rename to sup3r/configs/sup3rcc/gen_solar_1x_8x_1f.json index 01d00b552..81a4ace20 100644 --- a/sup3r/configs/solar_cc/gen_1x_8x_1f.json +++ b/sup3r/configs/sup3rcc/gen_solar_1x_8x_1f.json @@ -15,25 +15,20 @@ ] }, - {"class": "SkipConnection", "name": "big_skip"}, - {"n": 16, "repeat": [ - {"class": "SkipConnection", "name": "small_skip"}, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, {"class": "Cropping3D", "cropping": 2}, {"alpha": 0.2, "class": "LeakyReLU"}, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 2}, - {"class": "SkipConnection", "name": "small_skip"} + {"class": "Cropping3D", "cropping": 2} ] }, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, {"class": "Cropping3D", "cropping": 2}, - {"class": "SkipConnection", "name": "big_skip"}, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, {"class": "Conv3D", "filters": 1, "kernel_size": 3, "strides": 1}, diff --git a/sup3r/configs/sup3rcc/gen_solar_5x_1x_1f.json b/sup3r/configs/sup3rcc/gen_solar_5x_1x_1f.json new file mode 100644 index 000000000..115b2ca48 --- /dev/null +++ b/sup3r/configs/sup3rcc/gen_solar_5x_1x_1f.json @@ -0,0 +1,38 @@ +{ + "hidden_layers": [ + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + + {"class": "SkipConnection", "name": "big_skip"}, + + {"n": 16, "repeat": [ + {"class": "SkipConnection", "name": "small_skip"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"class": "SkipConnection", "name": "small_skip"} + ] + }, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"class": "SkipConnection", "name": "big_skip"}, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 1600, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"class": "SpatialExpansion", "spatial_mult": 5}, + {"alpha": 0.2, "class": "LeakyReLU"}, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 1, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2} + ] +} diff --git a/sup3r/configs/solar_cc/gen_1x_24x_1f.json b/sup3r/configs/sup3rcc/gen_trh_1x_24x_2f.json similarity index 83% rename from sup3r/configs/solar_cc/gen_1x_24x_1f.json rename to sup3r/configs/sup3rcc/gen_trh_1x_24x_2f.json index 21bd56ddf..b9077ff72 100644 --- a/sup3r/configs/solar_cc/gen_1x_24x_1f.json +++ b/sup3r/configs/sup3rcc/gen_trh_1x_24x_2f.json @@ -15,28 +15,23 @@ ] }, - {"class": "SkipConnection", "name": "big_skip"}, - {"n": 16, "repeat": [ - {"class": "SkipConnection", "name": "small_skip"}, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, {"class": "Cropping3D", "cropping": 2}, {"alpha": 0.2, "class": "LeakyReLU"}, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, - {"class": "Cropping3D", "cropping": 2}, - {"class": "SkipConnection", "name": "small_skip"} + {"class": "Cropping3D", "cropping": 2} ] }, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, {"class": "Cropping3D", "cropping": 2}, - {"class": "SkipConnection", "name": "big_skip"}, {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, - {"class": "Conv3D", "filters": 1, "kernel_size": 3, "strides": 1}, + {"class": "Conv3D", "filters": 2, "kernel_size": 3, "strides": 1}, {"class": "Cropping3D", "cropping": 2} ] } diff --git a/sup3r/configs/sup3rcc/gen_wind_1x_24x_6f.json b/sup3r/configs/sup3rcc/gen_wind_1x_24x_6f.json new file mode 100644 index 000000000..2491ffeb0 --- /dev/null +++ b/sup3r/configs/sup3rcc/gen_wind_1x_24x_6f.json @@ -0,0 +1,37 @@ +{ + "hidden_layers": [ + {"class": "FlexiblePadding", "paddings": [[0,0], [2,2], [2,2], [2,2], [0,0]], "mode": "REFLECT"}, + {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping3D", "cropping": 1}, + {"alpha": 0.2, "class": "LeakyReLU"}, + {"class": "SpatioTemporalExpansion", "temporal_mult": 3, "temporal_method": "nearest"}, + + {"n": 3, "repeat": [ + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping3D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + {"class": "SpatioTemporalExpansion", "temporal_mult": 2, "temporal_method": "nearest"} + ] + }, + + {"n": 16, "repeat": [ + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping3D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping3D", "cropping": 2} + ] + }, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv3D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping3D", "cropping": 2}, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv3D", "filters": 6, "kernel_size": 3, "strides": 1}, + {"class": "Cropping3D", "cropping": 2} + ] +} diff --git a/sup3r/configs/sup3rcc/gen_wind_5x_1x_6f.json b/sup3r/configs/sup3rcc/gen_wind_5x_1x_6f.json new file mode 100644 index 000000000..53ce739a0 --- /dev/null +++ b/sup3r/configs/sup3rcc/gen_wind_5x_1x_6f.json @@ -0,0 +1,60 @@ +{ + "hidden_layers": [ + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + + {"class": "SkipConnection", "name": "big_skip_1"}, + + {"n": 8, "repeat": [ + {"class": "SkipConnection", "name": "small_skip_1"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"class": "SkipConnection", "name": "small_skip_1"} + ] + }, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"class": "SkipConnection", "name": "big_skip_1"}, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 1600, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"class": "SpatialExpansion", "spatial_mult": 5}, + {"alpha": 0.2, "class": "LeakyReLU"}, + + {"class": "Sup3rConcat"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + + {"class": "SkipConnection", "name": "big_skip_2"}, + + {"n": 8, "repeat": [ + {"class": "SkipConnection", "name": "small_skip_2"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"alpha": 0.2, "class": "LeakyReLU"}, + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 64, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2}, + {"class": "SkipConnection", "name": "small_skip_2"} + ] + }, + {"class": "SkipConnection", "name": "big_skip_2"}, + + {"class": "FlexiblePadding", "paddings": [[0,0], [3,3], [3,3], [0,0]], "mode": "REFLECT"}, + {"class": "Conv2D", "filters": 6, "kernel_size": 3, "strides": 1}, + {"class": "Cropping2D", "cropping": 2} + ] +} diff --git a/sup3r/version.py b/sup3r/version.py index 221b8b546..5e4e04668 100644 --- a/sup3r/version.py +++ b/sup3r/version.py @@ -1,4 +1,4 @@ # -*- coding: utf-8 -*- """SUP3R Version""" -__version__ = '0.0.5' +__version__ = '0.0.6' diff --git a/tests/test_multi_step.py b/tests/test_multi_step.py index cc5d832b7..09695c215 100644 --- a/tests/test_multi_step.py +++ b/tests/test_multi_step.py @@ -179,7 +179,7 @@ def test_solar_multistep(): features_in_3 = ['clearsky_ratio', 'U_200m', 'V_200m'] features_out_3 = ['clearsky_ratio'] - fp_gen = os.path.join(CONFIG_DIR, 'solar_cc/gen_1x_8x_1f.json') + fp_gen = os.path.join(CONFIG_DIR, 'sup3rcc/gen_solar_1x_8x_1f.json') fp_disc = os.path.join(CONFIG_DIR, 'spatiotemporal/disc.json') model3 = Sup3rGan(fp_gen, fp_disc) _ = model3.generate(np.ones((4, 10, 10, 3, len(features_in_3)))) diff --git a/tests/test_train_solar.py b/tests/test_train_solar.py index 4f92cd2ed..15d269279 100644 --- a/tests/test_train_solar.py +++ b/tests/test_train_solar.py @@ -41,12 +41,12 @@ def test_solar_cc_model(log=False): worker_kwargs=dict(max_workers=1)) batcher = BatchHandlerCC([handler], batch_size=16, n_batches=2, - s_enhance=2, sub_daily_shape=9) + s_enhance=1, sub_daily_shape=24) if log: init_logger('sup3r', log_level='DEBUG') - fp_gen = os.path.join(CONFIG_DIR, 'solar_cc/gen_2x_3x_1f.json') + fp_gen = os.path.join(CONFIG_DIR, 'sup3rcc/gen_solar_1x_8x_1f.json') fp_disc = os.path.join(CONFIG_DIR, 'spatiotemporal/disc.json') Sup3rGan.seed() @@ -76,9 +76,9 @@ def test_solar_cc_model(log=False): x = np.random.uniform(0, 1, (1, 30, 30, 3, 1)) y = model.generate(x) assert y.shape[0] == x.shape[0] - assert y.shape[1] == x.shape[1] * 2 - assert y.shape[2] == x.shape[2] * 2 - assert y.shape[3] == x.shape[3] * 3 + assert y.shape[1] == x.shape[1] + assert y.shape[2] == x.shape[2] + assert y.shape[3] == x.shape[3] * 8 assert y.shape[4] == x.shape[4] @@ -96,12 +96,12 @@ def test_solar_cc_model_spatial(log=False): worker_kwargs=dict(max_workers=1)) batcher = SpatialBatchHandlerCC([handler], batch_size=8, n_batches=10, - s_enhance=2) + s_enhance=5) if log: init_logger('sup3r', log_level='DEBUG') - fp_gen = os.path.join(CONFIG_DIR, 'spatial/gen_2x_1f.json') + fp_gen = os.path.join(CONFIG_DIR, 'sup3rcc/gen_solar_5x_1x_1f.json') fp_disc = os.path.join(CONFIG_DIR, 'spatial/disc.json') Sup3rGan.seed() @@ -118,15 +118,15 @@ def test_solar_cc_model_spatial(log=False): assert model.meta['output_features'] == ['clearsky_ratio'] assert model.meta['class'] == 'Sup3rGan' - x = np.random.uniform(0, 1, (4, 30, 30, 1)) + x = np.random.uniform(0, 1, (4, 10, 10, 1)) y = model.generate(x) assert y.shape[0] == x.shape[0] - assert y.shape[1] == x.shape[1] * 2 - assert y.shape[2] == x.shape[2] * 2 + assert y.shape[1] == x.shape[1] * 5 + assert y.shape[2] == x.shape[2] * 5 assert y.shape[3] == x.shape[3] -def test_solar_custom_loss(sub_daily_shape=24, log=False): +def test_solar_custom_loss(log=False): """Test custom solar loss with only disc and content over daylight hours""" handler = DataHandlerH5SolarCC(INPUT_FILE_S, FEATURES_S, target=TARGET_S, shape=SHAPE, @@ -136,12 +136,12 @@ def test_solar_custom_loss(sub_daily_shape=24, log=False): worker_kwargs=dict(max_workers=1)) batcher = BatchHandlerCC([handler], batch_size=1, n_batches=1, - s_enhance=1, sub_daily_shape=sub_daily_shape) + s_enhance=1, sub_daily_shape=24) if log: init_logger('sup3r', log_level='DEBUG') - fp_gen = os.path.join(CONFIG_DIR, 'solar_cc/gen_1x_8x_1f.json') + fp_gen = os.path.join(CONFIG_DIR, 'sup3rcc/gen_solar_1x_8x_1f.json') fp_disc = os.path.join(CONFIG_DIR, 'spatiotemporal/disc.json') Sup3rGan.seed()