{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "### Try out the VortexaSDK" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First let's import our requirements" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2020-12-29T16:41:51.624559Z", "iopub.status.busy": "2020-12-29T16:41:51.623834Z", "iopub.status.idle": "2020-12-29T16:41:52.022363Z", "shell.execute_reply": "2020-12-29T16:41:52.022763Z" } }, "outputs": [], "source": [ "from datetime import datetime\n", "import vortexasdk as v" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lets use the CargoTimeSeries endpoint to answer the following question:" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- _What was the monthly average barrels per day of crude loaded from Rotterdam over the last year_?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "First we'll find the IDs corresponding to Rotterdam and Crude" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2020-12-29T16:41:52.027351Z", "iopub.status.busy": "2020-12-29T16:41:52.026532Z", "iopub.status.idle": "2020-12-29T16:41:53.167484Z", "shell.execute_reply": "2020-12-29T16:41:53.168114Z" } }, "outputs": [], "source": [ "rotterdam = [g.id for g in v.Geographies().search(\"Rotterdam\", exact_term_match=True).to_list()]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2020-12-29T16:41:53.173512Z", "iopub.status.busy": "2020-12-29T16:41:53.172508Z", "iopub.status.idle": "2020-12-29T16:41:53.756482Z", "shell.execute_reply": "2020-12-29T16:41:53.756943Z" } }, "outputs": [], "source": [ "crude = [p.id for p in v.Products().search(\"Crude\", exact_term_match=True).to_list()]" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2020-12-29T16:41:53.761683Z", "iopub.status.busy": "2020-12-29T16:41:53.760793Z", "iopub.status.idle": "2020-12-29T16:41:54.623159Z", "shell.execute_reply": "2020-12-29T16:41:54.624361Z" } }, "outputs": [], "source": [ "search_result = v.CargoTimeSeries().search(\n", " timeseries_unit='bpd',\n", " timeseries_frequency='month',\n", " filter_origins=rotterdam,\n", " filter_products=crude,\n", " filter_activity='loading_state',\n", " filter_time_min=datetime(2018, 1, 1),\n", " filter_time_max=datetime(2018, 12, 31))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2020-12-29T16:41:54.632062Z", "iopub.status.busy": "2020-12-29T16:41:54.631218Z", "iopub.status.idle": "2020-12-29T16:41:54.633557Z", "shell.execute_reply": "2020-12-29T16:41:54.634132Z" } }, "outputs": [], "source": [ "df = search_result.to_df()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2020-12-29T16:41:54.644182Z", "iopub.status.busy": "2020-12-29T16:41:54.643393Z", "iopub.status.idle": "2020-12-29T16:41:54.653619Z", "shell.execute_reply": "2020-12-29T16:41:54.654072Z" } }, "outputs": [], "source": [ "df.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "That's it! You've successfully loaded data using the Vortexa SDK. Check out https://vortechsa.github.io/python-sdk/ for more examples" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.9" } }, "nbformat": 4, "nbformat_minor": 4 }