[yt-svn] commit/yt: 2 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sat Jul 16 08:44:13 PDT 2016
2 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/e70e0c843764/
Changeset: e70e0c843764
Branch: yt
User: ngoldbaum
Date: 2016-07-12 18:38:28+00:00
Summary: Make it possible to pass field tuples to command-line plotting
Affected #: 1 file
diff -r 34215a75cce49013f1910ac18733a926a668241e -r e70e0c843764eff3dbd4ee8cfcf7fbc084cc94ce yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -45,7 +45,7 @@
ProjectionPlot
from yt.utilities.metadata import get_metadata
from yt.utilities.exceptions import \
- YTOutputNotIdentified
+ YTOutputNotIdentified, YTFieldNotParseable
# loading field plugins for backward compatibility, since this module
# used to do "from yt.mods import *"
@@ -142,6 +142,16 @@
@classmethod
def run(cls, args):
self = cls()
+ # Check for some things we know; for instance, comma separated
+ # field names should be parsed as tuples.
+ if hasattr(args, 'field') and ',' in args.field:
+ if args.field.count(",") > 1:
+ raise YTFieldNotParseable(args.field)
+ args.field = tuple(_.strip() for _ in args.field.split(","))
+ if hasattr(args, 'weight') and ',' in args.weight:
+ if args.weight.count(",") > 1:
+ raise YTFieldNotParseable(args.weight)
+ args.weight = tuple(_.strip() for _ in args.weight.split(","))
# Some commands need to be run repeatedly on datasets
# In fact, this is the rule and the opposite is the exception
# BUT, we only want to parse the arguments once.
@@ -199,11 +209,13 @@
field = dict(short="-f", longname="--field",
action="store", type=str,
dest="field", default="density",
- help="Field to color by"),
+ help=("Field to color by, "
+ "use a comma to separate field tuple values")),
weight = dict(short="-g", longname="--weight",
action="store", type=str,
dest="weight", default=None,
- help="Field to weight projections with"),
+ help=("Field to weight projections with, "
+ "use a comma to separate field tuple values")),
cmap = dict(longname="--colormap",
action="store", type=str,
dest="cmap", default=_default_colormap,
https://bitbucket.org/yt_analysis/yt/commits/32d6f2c94519/
Changeset: 32d6f2c94519
Branch: yt
User: xarthisius
Date: 2016-07-16 15:43:45+00:00
Summary: Merged in ngoldbaum/yt (pull request #2273)
Make it possible to pass field tuples to command-line plotting
Affected #: 1 file
diff -r 1c339ea7619997cba6842e973cf5f0e13b2f30ee -r 32d6f2c945190b3f101f0c2a895b968bc570cbac yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -45,7 +45,7 @@
ProjectionPlot
from yt.utilities.metadata import get_metadata
from yt.utilities.exceptions import \
- YTOutputNotIdentified
+ YTOutputNotIdentified, YTFieldNotParseable
# loading field plugins for backward compatibility, since this module
# used to do "from yt.mods import *"
@@ -142,6 +142,16 @@
@classmethod
def run(cls, args):
self = cls()
+ # Check for some things we know; for instance, comma separated
+ # field names should be parsed as tuples.
+ if hasattr(args, 'field') and ',' in args.field:
+ if args.field.count(",") > 1:
+ raise YTFieldNotParseable(args.field)
+ args.field = tuple(_.strip() for _ in args.field.split(","))
+ if hasattr(args, 'weight') and ',' in args.weight:
+ if args.weight.count(",") > 1:
+ raise YTFieldNotParseable(args.weight)
+ args.weight = tuple(_.strip() for _ in args.weight.split(","))
# Some commands need to be run repeatedly on datasets
# In fact, this is the rule and the opposite is the exception
# BUT, we only want to parse the arguments once.
@@ -199,11 +209,13 @@
field = dict(short="-f", longname="--field",
action="store", type=str,
dest="field", default="density",
- help="Field to color by"),
+ help=("Field to color by, "
+ "use a comma to separate field tuple values")),
weight = dict(short="-g", longname="--weight",
action="store", type=str,
dest="weight", default=None,
- help="Field to weight projections with"),
+ help=("Field to weight projections with, "
+ "use a comma to separate field tuple values")),
cmap = dict(longname="--colormap",
action="store", type=str,
dest="cmap", default=_default_colormap,
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list