Repository: vaexio/vaex

Issue:
vaex.example() is broken
`vaex.example()` is doesn't work because http://vaex.astro.rug.nl/data/helmi-dezeeuw-2000-10p.hdf5 returns a 403 (at the time of writing). This is with `vaex` 1.0.0b7 and `vaex-core` 0.6.1 from conda-forge.


Discussion:
Hi Teake,

thanks for letting me know, it seems the machine at Kapteyn that has this file is offline. I'll try to see if it can be put online.

cheers,

Maarten
Could potentially see if we can store these in s3 - so we don't have to worry about this kind of thing. What do you think @maartenbreddels ?
Yes, that is a great idea! After #267 is merged, we can fully depend on s3, also for larger datasets, since it will only download what is needed.
Awesome thanks! 

This might be a nice issue for a newcomer like me to work on! Once the below is merged I’m happy to take a look at copying the data across to s3 and updating the relevant code in .example()

Sent from my iPhone

> On 21 May 2019, at 09:18, Maarten Breddels <notifications@github.com> wrote:
> 
> Yes, that is a great idea! After #267 is merged, we can fully depend on s3, also for larger datasets, since it will only download what is needed.
> 
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub, or mute the thread.

Great, see https://github.com/vaexio/vaex/blob/master/tests/s3_test.py for the usage.
Hi, I just ran into this 403 error trying to run df = vaex.example() with a fresh install of vaex and jupyter lab (via conda). Was this ever fixed? 
Yeah, we noticed, it was fixed, but @JovanVeljanoski is setting up a more permanent solution now

Resolving patch:
diff --git a/packages/vaex-core/vaex/__init__.py b/packages/vaex-core/vaex/__init__.py
--- a/packages/vaex-core/vaex/__init__.py
+++ b/packages/vaex-core/vaex/__init__.py
@@ -551,16 +551,13 @@ def connect(url, **kwargs):
     from vaex.server import connect
     return connect(url, **kwargs)
 
-def example(download=True):
+
+def example():
     """Returns an example DataFrame which comes with vaex for testing/learning purposes.
 
     :rtype: DataFrame
     """
-    from . import utils
-    path = utils.get_data_file("helmi-dezeeuw-2000-10p.hdf5")
-    if path is None and download:
-        return vaex.datasets.helmi_de_zeeuw_10percent.fetch()
-    return open(path) if path else None
+    return vaex.datasets.helmi_de_zeeuw_10percent.fetch()
 
 
 def zeldovich(dim=2, N=256, n=-2.5, t=None, scale=1, seed=None):
diff --git a/packages/vaex-core/vaex/datasets.py b/packages/vaex-core/vaex/datasets.py
--- a/packages/vaex-core/vaex/datasets.py
+++ b/packages/vaex-core/vaex/datasets.py
@@ -249,7 +249,7 @@ def open(self):
 nyctaxi_yellow_2015 = NYCTaxi("nyc_taxi2015", urllist[-12:])
 nyctaxi_yellow_201x = NYCTaxi("nyc_taxi_all", [url for url in urllist if "yellow" in url and "201" in url])
 
-helmi_de_zeeuw = Hdf5Download("http://vaex.astro.rug.nl/data/helmi-dezeeuw-2000-FeH.hdf5")
-helmi_de_zeeuw_10percent = Hdf5Download("http://vaex.astro.rug.nl/data/helmi-dezeeuw-2000-10p.hdf5")
-tgas = Hdf5Download("http://vaex.astro.rug.nl/data/tgas.hdf5")
-tgas_1percent = Hdf5Download("http://vaex.astro.rug.nl/data/tgas_1percent.hdf5")
+helmi_de_zeeuw = Hdf5Download("https://github.com/vaexio/vaex-datasets/releases/download/v1.0/helmi-dezeeuw-2000-FeH-v2.hdf5")
+helmi_de_zeeuw_10percent = Hdf5Download("https://github.com/vaexio/vaex-datasets/releases/download/v1.0/helmi-dezeeuw-2000-FeH-v2-10percent.hdf5")
+tgas = Hdf5Download("https://github.com/vaexio/vaex-datasets/releases/download/v1.0/tgas.hdf5")
+tgas_1percent = Hdf5Download("https://github.com/vaexio/vaex-datasets/releases/download/v1.0/tgas_1percent.hdf5")
diff --git a/packages/vaex-core/vaex/utils.py b/packages/vaex-core/vaex/utils.py
--- a/packages/vaex-core/vaex/utils.py
+++ b/packages/vaex-core/vaex/utils.py
@@ -142,28 +142,6 @@ def disjoined(data):
     return data_disjoined
 
 
-def get_data_file(filename):
-    try:  # this works for egg like stuff, but fails for py2app apps
-        from pkg_resources import Requirement, resource_filename
-        path = resource_filename(Requirement.parse("vaex"), filename)
-        if os.path.exists(path):
-            return path
-    except:
-        pass
-    # this is where we expect data to be in normal installations
-    for extra in ["", "data", "data/dist", "../data", "../data/dist"]:
-        path = os.path.join(os.path.dirname(__file__), "..", "..", extra, filename)
-        if os.path.exists(path):
-            return path
-        path = os.path.join(sys.prefix, extra, filename)
-        if os.path.exists(path):
-            return path
-        # if all fails..
-        path = os.path.join(get_root_path(), extra, filename)
-        if os.path.exists(path):
-            return path
-
-
 def get_root_path():
     osname = platform.system().lower()
     # if (osname == "linux") and is_frozen: # we are using pyinstaller


Test patch:
diff --git a/tests/virtual_columns_test.py b/tests/virtual_columns_test.py
--- a/tests/virtual_columns_test.py
+++ b/tests/virtual_columns_test.py
@@ -8,13 +8,13 @@ def test_add_virtual_columns_polar_velocities_to_cartesian():
 
     # With azimuth = None
     ds.add_virtual_columns_polar_velocities_to_cartesian(vx_out='vx_', vy_out='vy_')
-    np.testing.assert_almost_equal(ds.evaluate('vx'), ds.evaluate('vx_'), err_msg='error with converting polar to Cartesian velocities')
-    np.testing.assert_almost_equal(ds.evaluate('vy'), ds.evaluate('vy_'), err_msg='error with converting polar to Cartesian velocities')
+    np.testing.assert_almost_equal(ds.evaluate('vx'), ds.evaluate('vx_'), err_msg='error with converting polar to Cartesian velocities', decimal=3)
+    np.testing.assert_almost_equal(ds.evaluate('vy'), ds.evaluate('vy_'), err_msg='error with converting polar to Cartesian velocities', decimal=3)
 
     # With azimuth provided
     ds.add_virtual_columns_polar_velocities_to_cartesian(azimuth='phi_polar', vx_out='vx_', vy_out='vy_')
-    np.testing.assert_almost_equal(ds.evaluate('vx'), ds.evaluate('vx_'), err_msg='error with converting polar to Cartesian velocities')
-    np.testing.assert_almost_equal(ds.evaluate('vy'), ds.evaluate('vy_'), err_msg='error with converting polar to Cartesian velocities')
+    np.testing.assert_almost_equal(ds.evaluate('vx'), ds.evaluate('vx_'), err_msg='error with converting polar to Cartesian velocities', decimal=3)
+    np.testing.assert_almost_equal(ds.evaluate('vy'), ds.evaluate('vy_'), err_msg='error with converting polar to Cartesian velocities', decimal=3)
 
     # this tests the angular momentum conversion
     ds.add_virtual_columns_cartesian_angular_momenta(Lx='Lx_', Ly='Ly_', Lz='Lz_')