[yt-svn] commit/yt: 7 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Jan 6 11:15:42 PST 2017
7 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/2fff863fd94c/
Changeset: 2fff863fd94c
Branch: yt
User: jzuhone
Date: 2016-12-10 18:58:10+00:00
Summary: Adding “supp_data_dir” config option
Affected #: 1 file
diff -r 078774898c0b14002775f250e6c4dc7930d3b7b0 -r 2fff863fd94cb8968be11d689c0c72cd275f29a4 yt/config.py
--- a/yt/config.py
+++ b/yt/config.py
@@ -67,6 +67,7 @@
ignore_invalid_unit_operation_errors = 'False',
chunk_size = '1000',
xray_data_dir = '/does/not/exist',
+ supp_data_dir = '/does/not/exist',
default_colormap = 'arbre',
ray_tracing_engine = 'embree',
)
https://bitbucket.org/yt_analysis/yt/commits/cab80d796bc8/
Changeset: cab80d796bc8
Branch: yt
User: jzuhone
Date: 2016-12-10 20:02:05+00:00
Summary: A command-line utility for downloading a file from http://yt-project.org/data
Affected #: 1 file
diff -r 2fff863fd94cb8968be11d689c0c72cd275f29a4 -r cab80d796bc80ea8d89ba4a339566e1c8892afea yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -36,7 +36,8 @@
mylog, \
ensure_dir_exists, \
update_hg, \
- enable_plugins
+ enable_plugins, \
+ download_file
from yt.extern.six import add_metaclass, string_types
from yt.extern.six.moves import urllib, input
from yt.extern.six.moves.urllib.parse import urlparse
@@ -1310,6 +1311,43 @@
print("Identified %s records output to %s" % (
len(records), args.output))
+class YTDownloadData(YTCommand):
+
+ args = (dict(short="filename", action="store", type=str,
+ help="The name of the file to download"),
+ dict(short="location", action="store", type=str,
+ help="The location in which to place downloaded file"),
+ dict(longname="--clobber", short="-c",
+ help="Output full contents of parameter file",
+ action="store_true", default=False),
+ )
+ description = \
+ """
+ Download a file from http://yt-project.org/data and
+ save it to a particular location. Options are:
+ * "test_data_dir": Save the file to the location
+ * "supp_data_dir": Save the file to the location
+ * Any valid path to a location on disk.
+ """
+ name = "download"
+
+ def __call__(self, args):
+ data_url = "http://yt-project.org/data/%s" % args.filename
+ if args.location in ["test_data_dir", "supp_data_dir"]:
+ data_dir = ytcfg.get("yt", args.location)
+ if data_dir == "/does/not/exist":
+ raise RuntimeError("'%s' is not configured!" % args.location)
+ else:
+ data_dir = args.location
+ if not os.path.exists(data_dir):
+ raise IOError("The directory '%s' does not exist!!" % data_dir)
+ data_file = os.path.join(data_dir, args.filename)
+ if os.path.exists(data_file) and not args.clobber:
+ raise IOError("File '%s' exists and clobber=False!" % data_file)
+ fn = download_file(data_url, data_file)
+ if not os.path.exists(fn):
+ raise IOError("The file '%s' did not download!!" % args.filename)
+
def run_main():
args = parser.parse_args()
# The following is a workaround for a nasty Python 3 bug:
@@ -1320,7 +1358,7 @@
except AttributeError:
parser.print_help()
sys.exit(0)
-
+
args.func(args)
if __name__ == "__main__": run_main()
https://bitbucket.org/yt_analysis/yt/commits/ed520bfb5e4f/
Changeset: ed520bfb5e4f
Branch: yt
User: jzuhone
Date: 2016-12-11 16:49:02+00:00
Summary: Document supp_data_dir
Affected #: 1 file
diff -r cab80d796bc80ea8d89ba4a339566e1c8892afea -r ed520bfb5e4fb582415b55dda2d124a1c01fe6f0 doc/source/reference/configuration.rst
--- a/doc/source/reference/configuration.rst
+++ b/doc/source/reference/configuration.rst
@@ -109,6 +109,8 @@
to stdout rather than stderr
* ``skip_dataset_cache`` (default: ``'False'``): If true, automatic caching of datasets
is turned off.
+* ``supp_data_dir`` (default: ``'/does/not/exist'``): The default path certain
+ submodules of yt look in for supplemental data files.
.. _plugin-file:
https://bitbucket.org/yt_analysis/yt/commits/75fa5a017e1b/
Changeset: 75fa5a017e1b
Branch: yt
User: jzuhone
Date: 2016-12-11 16:49:14+00:00
Summary: Document yt download
Affected #: 2 files
diff -r ed520bfb5e4fb582415b55dda2d124a1c01fe6f0 -r 75fa5a017e1bccd943c67bf5202a1012774579bf doc/source/reference/command-line.rst
--- a/doc/source/reference/command-line.rst
+++ b/doc/source/reference/command-line.rst
@@ -276,6 +276,34 @@
$ yt hub start
$ yt hub start /user/xarthisius/Public
+download
+~~~~~~~~
+
+This subcommand downloads a file from http://yt-project.org/data. Using ``yt download``,
+one can download a file to:
+
+* ``"test_data_dir"``: Save the file to the location specified in
+ the ``"test_data_dir"`` configuration entry for test data.
+* ``"supp_data_dir"``: Save the file to the location specified in
+ the ``"supp_data_dir"`` configuration entry for supplemental data.
+* Any valid path to a location on disk, e.g. ``/home/jzuhone/data``.
+
+Examples:
+
+.. code-block:: bash
+
+ $ yt download apec_emissivity_v2.h5 supp_data_dir
+
+.. code-block:: bash
+
+ $ yt download GasSloshing.tar.gz test_data_dir
+
+.. code-block:: bash
+
+ $ yt download ZeldovichPancake.tar.gz /Users/jzuhone/workspace
+
+If the configuration values ``"test_data_dir"`` or ``"supp_data_dir"`` have not
+been set by the user, an error will be thrown.
Config helper
~~~~~~~~~~~~~
diff -r ed520bfb5e4fb582415b55dda2d124a1c01fe6f0 -r 75fa5a017e1bccd943c67bf5202a1012774579bf yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1325,8 +1325,10 @@
"""
Download a file from http://yt-project.org/data and
save it to a particular location. Options are:
- * "test_data_dir": Save the file to the location
- * "supp_data_dir": Save the file to the location
+ * "test_data_dir": Save the file to the location specified
+ in the ``"test_data_dir"`` configuration entry for test data.
+ * "supp_data_dir": Save the file to the location specified
+ in the ``"supp_data_dir"`` configuration entry for supplemental data.
* Any valid path to a location on disk.
"""
name = "download"
https://bitbucket.org/yt_analysis/yt/commits/e25c10878db7/
Changeset: e25c10878db7
Branch: yt
User: jzuhone
Date: 2017-01-04 14:40:09+00:00
Summary: Make the directory if it doesn’t exist.
Affected #: 1 file
diff -r 75fa5a017e1bccd943c67bf5202a1012774579bf -r e25c10878db7584fea5db9c6c7045fa8821ed85f yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1342,7 +1342,8 @@
else:
data_dir = args.location
if not os.path.exists(data_dir):
- raise IOError("The directory '%s' does not exist!!" % data_dir)
+ print("The directory '%s' does not exist. Creating..." % data_dir)
+ os.mkdir(data_dir)
data_file = os.path.join(data_dir, args.filename)
if os.path.exists(data_file) and not args.clobber:
raise IOError("File '%s' exists and clobber=False!" % data_file)
https://bitbucket.org/yt_analysis/yt/commits/6c0a11b713d4/
Changeset: 6c0a11b713d4
Branch: yt
User: jzuhone
Date: 2017-01-04 20:58:45+00:00
Summary: Try to make the descriptions easier to read but still providing all the info
Affected #: 1 file
diff -r e25c10878db7584fea5db9c6c7045fa8821ed85f -r 6c0a11b713d4b005f3a41fc99dda39ce7e4e0751 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -1316,20 +1316,19 @@
args = (dict(short="filename", action="store", type=str,
help="The name of the file to download"),
dict(short="location", action="store", type=str,
- help="The location in which to place downloaded file"),
+ help="The location in which to place the file, can be "
+ "\"supp_data_dir\", \"test_data_dir\", or any valid "
+ "path on disk. "),
dict(longname="--clobber", short="-c",
help="Output full contents of parameter file",
action="store_true", default=False),
)
description = \
"""
- Download a file from http://yt-project.org/data and
- save it to a particular location. Options are:
- * "test_data_dir": Save the file to the location specified
- in the ``"test_data_dir"`` configuration entry for test data.
- * "supp_data_dir": Save the file to the location specified
- in the ``"supp_data_dir"`` configuration entry for supplemental data.
- * Any valid path to a location on disk.
+ Download a file from http://yt-project.org/data and save it to a
+ particular location. Files can be saved to the locations provided
+ by the "test_data_dir" or "supp_data_dir" configuration entries, or
+ any valid path to a location on disk.
"""
name = "download"
https://bitbucket.org/yt_analysis/yt/commits/276ece4b97fb/
Changeset: 276ece4b97fb
Branch: yt
User: ngoldbaum
Date: 2017-01-06 19:15:14+00:00
Summary: Merged in jzuhone/yt (pull request #2471)
Download files from command line using "yt download" and "supp_data_dir" config option
Affected #: 4 files
diff -r 6dc7c9a92d34f3e3319e37ebc1448899742f247a -r 276ece4b97fbac9af28f5b1aebf0a177b2eae954 doc/source/reference/command-line.rst
--- a/doc/source/reference/command-line.rst
+++ b/doc/source/reference/command-line.rst
@@ -276,6 +276,34 @@
$ yt hub start
$ yt hub start /user/xarthisius/Public
+download
+~~~~~~~~
+
+This subcommand downloads a file from http://yt-project.org/data. Using ``yt download``,
+one can download a file to:
+
+* ``"test_data_dir"``: Save the file to the location specified in
+ the ``"test_data_dir"`` configuration entry for test data.
+* ``"supp_data_dir"``: Save the file to the location specified in
+ the ``"supp_data_dir"`` configuration entry for supplemental data.
+* Any valid path to a location on disk, e.g. ``/home/jzuhone/data``.
+
+Examples:
+
+.. code-block:: bash
+
+ $ yt download apec_emissivity_v2.h5 supp_data_dir
+
+.. code-block:: bash
+
+ $ yt download GasSloshing.tar.gz test_data_dir
+
+.. code-block:: bash
+
+ $ yt download ZeldovichPancake.tar.gz /Users/jzuhone/workspace
+
+If the configuration values ``"test_data_dir"`` or ``"supp_data_dir"`` have not
+been set by the user, an error will be thrown.
Config helper
~~~~~~~~~~~~~
diff -r 6dc7c9a92d34f3e3319e37ebc1448899742f247a -r 276ece4b97fbac9af28f5b1aebf0a177b2eae954 doc/source/reference/configuration.rst
--- a/doc/source/reference/configuration.rst
+++ b/doc/source/reference/configuration.rst
@@ -109,6 +109,8 @@
to stdout rather than stderr
* ``skip_dataset_cache`` (default: ``'False'``): If true, automatic caching of datasets
is turned off.
+* ``supp_data_dir`` (default: ``'/does/not/exist'``): The default path certain
+ submodules of yt look in for supplemental data files.
.. _plugin-file:
diff -r 6dc7c9a92d34f3e3319e37ebc1448899742f247a -r 276ece4b97fbac9af28f5b1aebf0a177b2eae954 yt/config.py
--- a/yt/config.py
+++ b/yt/config.py
@@ -67,6 +67,7 @@
ignore_invalid_unit_operation_errors = 'False',
chunk_size = '1000',
xray_data_dir = '/does/not/exist',
+ supp_data_dir = '/does/not/exist',
default_colormap = 'arbre',
ray_tracing_engine = 'embree',
)
diff -r 6dc7c9a92d34f3e3319e37ebc1448899742f247a -r 276ece4b97fbac9af28f5b1aebf0a177b2eae954 yt/utilities/command_line.py
--- a/yt/utilities/command_line.py
+++ b/yt/utilities/command_line.py
@@ -36,7 +36,8 @@
mylog, \
ensure_dir_exists, \
update_hg, \
- enable_plugins
+ enable_plugins, \
+ download_file
from yt.extern.six import add_metaclass, string_types
from yt.extern.six.moves import urllib, input
from yt.extern.six.moves.urllib.parse import urlparse
@@ -1310,6 +1311,45 @@
print("Identified %s records output to %s" % (
len(records), args.output))
+class YTDownloadData(YTCommand):
+
+ args = (dict(short="filename", action="store", type=str,
+ help="The name of the file to download"),
+ dict(short="location", action="store", type=str,
+ help="The location in which to place the file, can be "
+ "\"supp_data_dir\", \"test_data_dir\", or any valid "
+ "path on disk. "),
+ dict(longname="--clobber", short="-c",
+ help="Output full contents of parameter file",
+ action="store_true", default=False),
+ )
+ description = \
+ """
+ Download a file from http://yt-project.org/data and save it to a
+ particular location. Files can be saved to the locations provided
+ by the "test_data_dir" or "supp_data_dir" configuration entries, or
+ any valid path to a location on disk.
+ """
+ name = "download"
+
+ def __call__(self, args):
+ data_url = "http://yt-project.org/data/%s" % args.filename
+ if args.location in ["test_data_dir", "supp_data_dir"]:
+ data_dir = ytcfg.get("yt", args.location)
+ if data_dir == "/does/not/exist":
+ raise RuntimeError("'%s' is not configured!" % args.location)
+ else:
+ data_dir = args.location
+ if not os.path.exists(data_dir):
+ print("The directory '%s' does not exist. Creating..." % data_dir)
+ os.mkdir(data_dir)
+ data_file = os.path.join(data_dir, args.filename)
+ if os.path.exists(data_file) and not args.clobber:
+ raise IOError("File '%s' exists and clobber=False!" % data_file)
+ fn = download_file(data_url, data_file)
+ if not os.path.exists(fn):
+ raise IOError("The file '%s' did not download!!" % args.filename)
+
def run_main():
args = parser.parse_args()
# The following is a workaround for a nasty Python 3 bug:
@@ -1320,7 +1360,7 @@
except AttributeError:
parser.print_help()
sys.exit(0)
-
+
args.func(args)
if __name__ == "__main__": run_main()
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