diff --git a/wc/.envrc b/wc/.envrc new file mode 100644 index 0000000..849a960 --- /dev/null +++ b/wc/.envrc @@ -0,0 +1 @@ +layout python python3.11 diff --git a/wc/README.md b/wc/README.md new file mode 100644 index 0000000..339fdf1 --- /dev/null +++ b/wc/README.md @@ -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 +``` diff --git a/wc/requirements.txt b/wc/requirements.txt new file mode 100644 index 0000000..830579f --- /dev/null +++ b/wc/requirements.txt @@ -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 diff --git a/wc/test.py b/wc/test.py new file mode 100644 index 0000000..247a284 --- /dev/null +++ b/wc/test.py @@ -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())