How to use vortexasdk - 10 common examples

To help you get started, we’ve selected a few vortexasdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github V0RT3X4 / python-sdk / tests / endpoints / test_vessel_movements_real.py View on Github external
def test_age_flag_scrubbers_filters(self):
        panama = [
            g.id
            for g in Geographies().search("panama").to_list()
            if "country" in g.layer
        ]

        df = (
            VesselMovements()
            .search(
                filter_vessel_scrubbers="inc",
                filter_vessel_age_min=2,
                filter_vessel_age_max=15,
                filter_vessel_flags=panama,
                filter_time_min=datetime(2017, 10, 1),
                filter_time_max=datetime(2017, 10, 1),
            )
            .to_df()
            .head(2)
        )
github V0RT3X4 / python-sdk / tests / endpoints / test_geographies_real.py View on Github external
def test_search(self):
        geographies = Geographies().search(term=["Liverpool", "Southampton"])
        names = [g["name"] for g in geographies]

        assert "Liverpool [GB]" in names
github V0RT3X4 / python-sdk / tests / endpoints / test_cargo_movements_real.py View on Github external
def test_search_single_filter_waypoint_name(self):
        df = (
            CargoMovements()
            .search(
                filter_activity="any_activity",
                filter_waypoints=[
                    g.id for g in Geographies().search(term="suez").to_list()
                ],
                filter_time_min=datetime(2019, 8, 29),
                filter_time_max=datetime(2019, 8, 29, 0, 10),
            )
            .to_df()
            .head(2)
        )

        assert len(df) == 2
github V0RT3X4 / python-sdk / tests / endpoints / test_vessel_movements_real.py View on Github external
def test_search(self):
        rotterdam = [
            g.id
            for g in Geographies().search("rotterdam").to_list()
            if "port" in g.layer
        ]
        v = VesselMovements().search(
            filter_time_min=datetime(2017, 10, 1, 0, 0),
            filter_time_max=datetime(2017, 10, 1, 0, 10),
            filter_origins=rotterdam,
        )

        assert len(v) > 10
github V0RT3X4 / python-sdk / tests / endpoints / test_cargo_time_series_real.py View on Github external
def test_filter_geographies_and_products(self):
        start = datetime(2019, 1, 1)
        end = datetime(2019, 11, 1)

        rotterdam = [
            g.id
            for g in Geographies().search(term="rotterdam").to_list()
            if "port" in g.layer
        ]
        crude = [
            p.id
            for p in Products().search("crude").to_list()
            if "Crude" == p.name
        ]

        rotterdam_crude_timeseries = (
            CargoTimeSeries()
            .search(
                filter_activity="loading_state",
                timeseries_unit="bpd",
                timeseries_frequency="month",
                filter_time_min=start,
                filter_time_max=end,
github V0RT3X4 / python-sdk / tests / endpoints / test_vessel_movements_real.py View on Github external
def test_exclusion_filter(self):
        meg = [
            g.id
            for g in Geographies().search("MEG/AG").to_list()
            if "trading_region" in g.layer
        ]
        iraq = [
            g.id
            for g in Geographies().search("Iraq").to_list()
            if "country" in g.layer
        ]
        bahri = [c.id for c in Corporations().search("BAHRI").to_list()]

        cols = [
            "vessel_movement_id",
            "vessel.name",
            "start_timestamp",
            "end_timestamp",
            "origin.location.country.id",
            "origin.location.country.label",
            "destination.location.country.id",
            "destination.location.country.label",
            "cargoes.0.product.group.label",
            "vessel.corporate_entities.charterer.id",
            "vessel.corporate_entities.charterer.label",
github V0RT3X4 / python-sdk / tests / endpoints / test_vessel_movements_real.py View on Github external
def test_to_df_all_columns(self):
        rotterdam = [
            g.id
            for g in Geographies().search("rotterdam").to_list()
            if "port" in g.layer
        ]
        df = (
            VesselMovements()
            .search(
                filter_time_min=datetime(2017, 10, 1, 0, 0),
                filter_time_max=datetime(2017, 10, 1, 0, 10),
                filter_origins=rotterdam,
            )
            .to_df(columns="all")
            .head(2)
        )

        assert len(df) == 2
github V0RT3X4 / python-sdk / tests / endpoints / test_cargo_movements_real.py View on Github external
def test_default_search(self):
        results = CargoMovements().search(filter_activity="loading_state")
        print(len(results))
github V0RT3X4 / python-sdk / tests / endpoints / test_cargo_movements_real.py View on Github external
def test_defaullt_search(self):
        results = CargoMovements().search()
        print(len(results))
github V0RT3X4 / python-sdk / tests / endpoints / test_cargo_movements_real.py View on Github external
def test_search_single_filter_id(self):
        df = (
            CargoMovements()
            .search(
                filter_activity="loading_state",
                filter_products="6f11b0724c9a4e85ffa7f1445bc768f054af755a090118dcf99f14745c261653",
                filter_time_min=datetime(2019, 8, 29),
                filter_time_max=datetime(2019, 8, 29, 0, 10),
            )
            .to_df()
            .head(2)
        )

        assert len(df) == 2