Weather Latest Function
get_grid(connection, parameters_dict)
A function to return the latest event values by querying databricks SQL Warehouse using a connection specified by the user.
This will return the raw weather forecast data for a grid.
The available connectors by RTDIP are Databricks SQL Connect, PYODBC SQL Connect, TURBODBC SQL Connect.
The available authentcation methods are Certificate Authentication, Client Secret Authentication or Default Authentication. See documentation.
This function requires the user to input a dictionary of parameters. (See Attributes table below)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connection |
object
|
Connection chosen by the user (Databricks SQL Connect, PYODBC SQL Connect, TURBODBC SQL Connect) |
required |
parameters_dict |
dict
|
A dictionary of parameters (see Attributes table below) |
required |
Attributes:
Name | Type | Description |
---|---|---|
source |
optional str
|
Source of the data the full table name |
forecast |
str
|
Any specific identifier for forecast |
forecast_type(str) |
str
|
Type of forecast ie weather, solar, power, etc |
region |
str
|
Region |
data_security_level |
str
|
Level of data security |
data_type |
str
|
Type of the data (float, integer, double, string) |
max_lat |
float
|
Maximum latitude |
max_lon |
float
|
Maximum longitude |
min_lat |
float
|
Minimum latitude |
min_lon |
float
|
Minimum longitude |
measurement |
optional str
|
Measurement type |
limit |
optional int
|
The number of rows to be returned |
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
A dataframe of event latest values. |
Source code in src/sdk/python/rtdip_sdk/queries/weather/latest.py
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
|
get_point(connection, parameters_dict)
A function to return the latest event values by querying databricks SQL Warehouse using a connection specified by the user.
This will return the raw weather forecast data for a single point.
The available connectors by RTDIP are Databricks SQL Connect, PYODBC SQL Connect, TURBODBC SQL Connect.
The available authentcation methods are Certificate Authentication, Client Secret Authentication or Default Authentication. See documentation.
This function requires the user to input a dictionary of parameters. (See Attributes table below)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
connection |
object
|
Connection chosen by the user (Databricks SQL Connect, PYODBC SQL Connect, TURBODBC SQL Connect) |
required |
parameters_dict |
dict
|
A dictionary of parameters (see Attributes table below) |
required |
Attributes:
Name | Type | Description |
---|---|---|
source |
optional str
|
Source of the data the full table name |
forecast |
str
|
Any specific identifier for forecast |
forecast_type(str) |
str
|
Type of forecast ie weather, solar, power, etc |
region |
str
|
Region |
data_security_level |
str
|
Level of data security |
data_type |
str
|
Type of the data (float, integer, double, string) |
lat |
float
|
latitude |
lon |
float
|
longitude |
measurement |
optional str
|
Measurement type |
limit |
optional int
|
The number of rows to be returned |
Returns:
Name | Type | Description |
---|---|---|
DataFrame |
DataFrame
|
A dataframe of event latest values. |
Source code in src/sdk/python/rtdip_sdk/queries/weather/latest.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
|
Example get_point
from rtdip_sdk.authentication.azure import DefaultAuth
from rtdip_sdk.connectors import DatabricksSQLConnection
from rtdip_sdk.queries import WeatherQueryBuilder
auth = DefaultAuth().authenticate()
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token)
data = (
WeatherQueryBuilder()
.connect(connection)
.source("{tablename_or_path}")
.latest_point(
lat="{latitude}",
lon="{longitude}",
)
)
print(data)
Example get_grid
from rtdip_sdk.authentication.azure import DefaultAuth
from rtdip_sdk.connectors import DatabricksSQLConnection
from rtdip_sdk.queries import WeatherQueryBuilder
auth = DefaultAuth().authenticate()
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token)
data = (
WeatherQueryBuilder()
.connect(connection)
.source("{tablename_or_path}")
.latest_grid(
min_lat="{minimum_latitude}",
min_lon="{minimum_longitude}",
max_lat="{maximum_latitude}",
max_lon="{maximum_longitude}",
)
)
print(data)
These examples are using DefaultAuth()
and DatabricksSQLConnection()
to authenticate and connect. You can find other ways to authenticate here. The alternative built in connection methods are either by PYODBCSQLConnection()
, TURBODBCSQLConnection()
or SparkConnection()
.
Note
server_hostname
and http_path
can be found on the SQL Warehouses Page.