Skip to content

Commit

Permalink
Merge pull request #129 from NREL/gb/sup3rcc_configs
Browse files Browse the repository at this point in the history
Gb/sup3rcc configs
  • Loading branch information
grantbuster committed Dec 21, 2022
2 parents 0ff1d11 + 1fb10b8 commit 286c774
Show file tree
Hide file tree
Showing 13 changed files with 191 additions and 140 deletions.
24 changes: 12 additions & 12 deletions sup3r/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""
Expand Down
18 changes: 0 additions & 18 deletions sup3r/configs/solar_cc/README.rst

This file was deleted.

44 changes: 0 additions & 44 deletions sup3r/configs/solar_cc/gen_10x_3x_1f.json

This file was deleted.

38 changes: 0 additions & 38 deletions sup3r/configs/solar_cc/gen_2x_3x_1f.json

This file was deleted.

26 changes: 26 additions & 0 deletions sup3r/configs/sup3rcc/README.rst
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
38 changes: 38 additions & 0 deletions sup3r/configs/sup3rcc/gen_solar_5x_1x_1f.json
Original file line number Diff line number Diff line change
@@ -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}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}
]
}
37 changes: 37 additions & 0 deletions sup3r/configs/sup3rcc/gen_wind_1x_24x_6f.json
Original file line number Diff line number Diff line change
@@ -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}
]
}
60 changes: 60 additions & 0 deletions sup3r/configs/sup3rcc/gen_wind_5x_1x_6f.json
Original file line number Diff line number Diff line change
@@ -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}
]
}
2 changes: 1 addition & 1 deletion sup3r/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
"""SUP3R Version"""

__version__ = '0.0.5'
__version__ = '0.0.6'
2 changes: 1 addition & 1 deletion tests/test_multi_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))))
Expand Down

0 comments on commit 286c774

Please sign in to comment.