forked from metomi/rose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
metomi#137: add rose edit, rose macro functionality
- Loading branch information
1 parent
bd1dc72
commit acc0e61
Showing
25 changed files
with
380 additions
and
106 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
demo/rose-config-edit/demo_meta/app/16-meta-import/rose-app.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
meta=rose-demo-baked-alaska/vn1.0 | ||
|
||
[env] | ||
ICECREAM_TEMPERATURE=-1 | ||
MERINGUE_NICENESS=0 | ||
SPONGE_DENSITY=0.1 |
4 changes: 4 additions & 0 deletions
4
etc/rose-meta/rose-demo-baked-alaska-icecream/HEAD/rose-meta.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[env=ICECREAM_TEMPERATURE] | ||
range=-20:0 | ||
title=Icecream Temperature (celsius) (version HEAD) | ||
type=integer |
4 changes: 4 additions & 0 deletions
4
etc/rose-meta/rose-demo-baked-alaska-icecream/vn1.0/rose-meta.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[env=ICECREAM_TEMPERATURE] | ||
range=-20:0 | ||
title=Icecream Temperature (celsius) (version 1) | ||
type=integer |
4 changes: 4 additions & 0 deletions
4
etc/rose-meta/rose-demo-baked-alaska-icecream/vn2.0/rose-meta.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[env=ICECREAM_TEMPERATURE] | ||
range=-20:0 | ||
title=Icecream Temperature (celsius) (version 2) | ||
type=integer |
4 changes: 4 additions & 0 deletions
4
etc/rose-meta/rose-demo-baked-alaska-sponge/HEAD/rose-meta.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[env=SPONGE_DENSITY] | ||
range=0:1 | ||
title=Sponge Density (g cm^-3) (version HEAD) | ||
type=real |
Empty file.
46 changes: 46 additions & 0 deletions
46
etc/rose-meta/rose-demo-baked-alaska-sponge/vn1.0/lib/python/macros/desoggy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# -*- coding: utf-8 -*- | ||
#----------------------------------------------------------------------------- | ||
# (C) British Crown Copyright 2012-4 Met Office. | ||
# | ||
# This file is part of Rose, a framework for meteorological suites. | ||
# | ||
# Rose is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# Rose is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with Rose. If not, see <http://www.gnu.org/licenses/>. | ||
#----------------------------------------------------------------------------- | ||
"""This module contains: | ||
SpongeDeSoggifier, a rose transform macro. | ||
""" | ||
|
||
import re | ||
import subprocess | ||
|
||
import rose.macro | ||
|
||
|
||
class SpongeDeSoggifier(rose.macro.MacroBase): | ||
|
||
"""De-soggifies the sponge.""" | ||
|
||
SOGGY_FIX_TEXT = "de-soggified" | ||
|
||
def transform(self, config, meta_config=None): | ||
"""Reduce the density of the sponge.""" | ||
sponge_density = config.get_value(["env", "SPONGE_DENSITY"]) | ||
if sponge_density is not None and float(sponge_density) > 0.5: | ||
# 1 g cm^-3 is pure water, so this is pretty soggy. | ||
config.set(["env", "SPONGE_DENSITY"], "0.3") | ||
self.add_report( | ||
"env", "SPONGE_DENSITY", "0.3", self.SOGGY_FIX_TEXT) | ||
return config, self.reports |
4 changes: 4 additions & 0 deletions
4
etc/rose-meta/rose-demo-baked-alaska-sponge/vn1.0/rose-meta.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[env=SPONGE_DENSITY] | ||
range=0:1 | ||
title=Sponge Density (g cm^-3) (version 1) | ||
type=real |
4 changes: 4 additions & 0 deletions
4
etc/rose-meta/rose-demo-baked-alaska-sponge/vn2.0/rose-meta.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[env=SPONGE_DENSITY] | ||
range=0:1 | ||
title=Sponge Density (g cm^-3) (version 2) | ||
type=real |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import=rose-demo-baked-alaska-icecream/HEAD rose-demo-baked-alaska-sponge/ | ||
|
||
[env=MERINGUE_NICENESS] | ||
title=Meringue Niceness (version HEAD) | ||
range=-20:20 | ||
type=integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import=rose-demo-baked-alaska-icecream/vn1.0 rose-demo-baked-alaska-sponge/vn1.0 | ||
|
||
[env=MERINGUE_NICENESS] | ||
title=Meringue Niceness (version 1) | ||
range=-20:20 | ||
type=integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import=rose-demo-baked-alaska-icecream/vn2.0 rose-demo-baked-alaska-sponge/vn2.0 | ||
|
||
[env=MERINGUE_NICENESS] | ||
title=Meringue Niceness (version 2) | ||
range=-20:20 | ||
type=integer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.