Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
cwasicki committed Dec 22, 2023
1 parent ccc89d1 commit 5a6bbb7
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions wc/.envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
layout python python3.11
13 changes: 13 additions & 0 deletions wc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SSH tunnel tested
```
ssh -N -L 50051:fz-0003.frequenz.io:50051 fz-0003.frequenz.io
ssh -N -L 50051:localhost:50051 fz-0003.frequenz.io
ssh -N -L 50051:0.0.0.0:50051 fz-0003.frequenz.io
```

SSH diagnostics
```
netstat -tuln | grep 50051
telnet localhost 50051
nc -vz localhost 50051
```
3 changes: 3 additions & 0 deletions wc/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#git+https://github.com/noah-kreutzer-frequenz/frequenz-api-weather@client_noah
#git+https://github.com/cwasicki/frequenz-api-weather@client_wc
git+https://github.com/cwasicki/frequenz-api-weather@noah
41 changes: 41 additions & 0 deletions wc/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import asyncio
from frequenz.client.weather._client import Client
from frequenz.client.weather._types import ForecastFeature, Location
import grpc.aio as grpcaio



async def main():
target="localhost:50051"

client = Client(
grpcaio.insecure_channel(target), # or secure channel with credentials
target,
)

features = [
ForecastFeature.V_WIND_COMPONENT_100_METRE,
ForecastFeature.U_WIND_COMPONENT_100_METRE,
]

locations = [
Location(
latitude=52.5,
longitude=13.4,
country_code="DE",
),
]

stream = await client.stream_live_forecast(
features=features,
locations=locations,
)

async for fc in stream:
print(fc)
print(fc.to_ndarray_vlf())
print(fc.to_ndarray_vlf(
features=[ForecastFeature.U_WIND_COMPONENT_100_METRE],
))

asyncio.run(main())

0 comments on commit 5a6bbb7

Please sign in to comment.