From f26001847b0ddb5c740d154f42315188050f11e9 Mon Sep 17 00:00:00 2001 From: Tyler Erickson Date: Wed, 27 Aug 2025 10:43:08 -0700 Subject: [PATCH] Add missing import; Format for readability --- README.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 973391c..b139df1 100644 --- a/README.md +++ b/README.md @@ -95,14 +95,30 @@ When using `NumPy`, hourly or daily data is readily available as a `NumPy` array ```python import numpy as np +from openmeteo_sdk.Variable import Variable hourly = response.Hourly() hourly_time = range(hourly.Time(), hourly.TimeEnd(), hourly.Interval()) hourly_variables = list(map(lambda i: hourly.Variables(i), range(0, hourly.VariablesLength()))) -hourly_temperature_2m = next(filter(lambda x: x.Variable() == Variable.temperature and x.Altitude() == 2, hourly_variables)).ValuesAsNumpy() -hourly_precipitation = next(filter(lambda x: x.Variable() == Variable.precipitation, hourly_variables)).ValuesAsNumpy() -hourly_wind_speed_10m = next(filter(lambda x: x.Variable() == Variable.wind_speed and x.Altitude() == 10, hourly_variables)).ValuesAsNumpy() +hourly_temperature_2m = next( + filter( + lambda x: x.Variable() == Variable.temperature and x.Altitude() == 2, + hourly_variables + ) +).ValuesAsNumpy() +hourly_precipitation = next( + filter( + lambda x: x.Variable() == Variable.precipitation, + hourly_variables + ) +).ValuesAsNumpy() +hourly_wind_speed_10m = next( + filter( + lambda x: x.Variable() == Variable.wind_speed and x.Altitude() == 10, + hourly_variables + ) +).ValuesAsNumpy() ``` ### Pandas