OpenMeteo.dotnet.client.sdk 5.14.3

dotnet add package OpenMeteo.dotnet.client.sdk --version 5.14.3
                    
NuGet\Install-Package OpenMeteo.dotnet.client.sdk -Version 5.14.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="OpenMeteo.dotnet.client.sdk" Version="5.14.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenMeteo.dotnet.client.sdk" Version="5.14.3" />
                    
Directory.Packages.props
<PackageReference Include="OpenMeteo.dotnet.client.sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add OpenMeteo.dotnet.client.sdk --version 5.14.3
                    
#r "nuget: OpenMeteo.dotnet.client.sdk, 5.14.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package OpenMeteo.dotnet.client.sdk@5.14.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=OpenMeteo.dotnet.client.sdk&version=5.14.3
                    
Install as a Cake Addin
#tool nuget:?package=OpenMeteo.dotnet.client.sdk&version=5.14.3
                    
Install as a Cake Tool

🌡️🌤️ Open-Meteo Dotnet Client SDK Library

build and test GitHub license Nuget

A .NET 8 client library for the Open-Meteo weather API. Forked from AlienDwarf/open-meteo-dotnet.

❕ Features

Pretty much all the library's classes are public, so you can extend the library as needed in your own code.

🔨 Installation

Add the NuGet package to your project:

dotnet add package OpenMeteo.dotnet.client.sdk

Requires .NET 8 or later.

💻 Usage

Quick start

Create one OpenMeteoClient and reuse it for every call.

using OpenMeteo;

var client = new OpenMeteoClient();

// Look up Tokyo by name and get its current weather
var weather = await client.QueryWeatherApiAsync("Tokyo");

Console.WriteLine($"Weather in Tokyo: {weather?.Current?.Temperature}{weather?.CurrentUnits?.Temperature}");
// Output: Weather in Tokyo: 28.1°C

Every query method returns null when the request fails, unless you turn on exceptions.

Weather forecast

Choose the variables, models, units and timezone with WeatherForecastOptions:

using OpenMeteo.Weather.Forecast.Options;

var options = new WeatherForecastOptions(52.52f, 13.41f)
{
    Current = [CurrentOptionsParameter.temperature_2m, CurrentOptionsParameter.windspeed_10m],
    Hourly = [HourlyOptionsParameter.temperature_2m, HourlyOptionsParameter.precipitation],
    Daily = [DailyOptionsParameter.temperature_2m_max, DailyOptionsParameter.temperature_2m_min],
    Models = [WeatherModelOptionsParameter.best_match],
    Timezone = "Europe/Berlin",
    Temperature_Unit = TemperatureUnitType.fahrenheit
};

var forecast = await client.QueryWeatherApiAsync(options);

float? maxToday = forecast?.Daily?.Temperature_2m_max?[0];

You can also pass a location name together with options (QueryWeatherApiAsync("Berlin", options)) or query several coordinates in one call (QueryWeatherApiAsync(coordinates, options)).

Ensemble forecast

The Ensemble API returns every ensemble member. Values are keyed by member number, where 0 is the control run.

using OpenMeteo.Weather.Ensemble.Options;

var options = new WeatherEnsembleOptions(52.52f, 13.41f)
{
    Hourly = [WeatherEnsembleHourlyOptionsParameter.temperature_2m],
    Models = [EnsembleModelOptionsParameter.gfs025]
};

var ensemble = await client.QueryEnsembleApiAsync(options);

foreach (var (member, values) in ensemble!.Hourly!.Temperature_2m!)
    Console.WriteLine($"Member {member}: {values?[0]}");

To compare several ensemble models, for example GFS, ECMWF IFS and Google WeatherNext 2, list them all in Models and call QueryEnsembleModelsApiAsync. It makes one request and returns one WeatherEnsemble per model, in the order you listed them. Each result's Model property says which model it holds. (QueryEnsembleApiAsync returns only the first model.)

var options = new WeatherEnsembleOptions(52.52f, 13.41f)
{
    Hourly = [WeatherEnsembleHourlyOptionsParameter.temperature_2m],
    Models = [EnsembleModelOptionsParameter.gfs025, EnsembleModelOptionsParameter.ecmwf_ifs025, EnsembleModelOptionsParameter.google_weathernext2_ensemble]
};

var ensembles = await client.QueryEnsembleModelsApiAsync(options);

foreach (var ensemble in ensembles!)
    Console.WriteLine($"{ensemble.Model}: {ensemble.Hourly!.Temperature_2m!.Count} members");

Seasonal forecast

The Seasonal Forecast API (ECMWF SEAS5 and EC46) forecasts up to 7 months ahead as hourly (6-hourly), daily, weekly and monthly data.

using OpenMeteo.Weather.Seasonal.Options;

var options = new SeasonalOptions(52.52f, 13.41f)
{
    Daily = [SeasonalDailyOptionsParameter.temperature_2m_max],
    Monthly = [SeasonalMonthlyOptionsParameter.temperature_2m_anomaly],
    Forecast_Days = 30
};

var seasonal = await client.QuerySeasonalApiAsync(options);

float?[]? control = seasonal!.Daily!.Get("temperature_2m_max");
IReadOnlyList<float?[]> members = seasonal.Daily.GetMembers("temperature_2m_max"); // one array per ensemble member
  • Variables of a series are looked up by their API name. Use Get for the control run (or the ensemble mean) and GetMembers for the individual members.
  • 6-hourly data is requested with Hourly, and weekly and monthly data with Weekly and Monthly. Choose a model with Models, for example ecmwf_seas5_ensemble_mean to get the ensemble mean instead of all 51 members.
  • The API ignores forecast_months. Limit the range with Forecast_Days (up to 217), Start_date/End_date or Past_Days.

Previous runs and single runs

QueryPreviousRunsApiAsync returns what earlier model runs predicted for the same hours (see the Previous Runs API), and QuerySingleRunsApiAsync returns one specific model run (see the Single Runs API). Both take PreviousRunsOptions and SingleRunsOptions.

Air quality

using OpenMeteo.AirQuality;

var options = new AirQualityOptions(52.52f, 13.41f)
{
    Hourly = [AirQualityOptions.HourlyOptionsParameter.pm10]
};

var airQuality = await client.QueryAirQualityAsync(options);

Geocoding and elevation

var location = await client.GetLocationDataAsync("Berlin");
Console.WriteLine(location?.Locations?[0].Name);

var elevation = await client.QueryElevationAsync(52.52f, 13.41f);
Console.WriteLine(elevation?.Elevation?[0]);

Regional model coverage

Regional models only cover part of the world. You can check whether a location falls inside a model's area without calling the API. The boundaries are built into the library. IsLocationInModelCoverage returns true or false for regional models and null for global ones.

using OpenMeteo.Weather.Ensemble.RegionalModelCoverage;
using OpenMeteo.Weather.Forecast.RegionalModelCoverage;

bool? inIconD2 = new RegionalModelCoverageHelper()
    .IsLocationInModelCoverage(WeatherModelOptionsParameter.icon_d2, 52.52f, 13.41f);   // true

bool? inEcmwfEurope = new EnsembleModelCoverageHelper()
    .IsLocationInModelCoverage(EnsembleModelOptionsParameter.ecmwf_ifs_europe_ensemble, 40.71f, -74.01f); // false

Both helpers have interfaces (IRegionalModelCoverageHelper and IEnsembleModelCoverageHelper) for dependency injection. The ICON-EU and ICON-D2 ensembles use the deterministic ICON boundaries, which are close to, but not exactly, their native grids.

⚙️ Configuration

API key

Pass your key to the constructor to use the customer API servers, such as customer-api.open-meteo.com:

var client = new OpenMeteoClient("YourSecretApiKeyHere");

Self-hosted instance

Point the client at your own Open-Meteo server, optionally combined with an API key:

var client = new OpenMeteoClient(new Uri("https://open-meteo.example.com"));

Custom HttpClient

Each constructor has an overload that accepts a pre-configured HttpClient, for example one from IHttpClientFactory:

var client = new OpenMeteoClient(httpClient);

FlatBuffers

Set UseFlatbuffers to request the binary FlatBuffers format, which parses much faster for large responses. The results are the same as with JSON.

var client = new OpenMeteoClient { UseFlatbuffers = true };

For the seasonal API this applies to hourly, daily and monthly data. The binary format has no start date for weekly data, so a seasonal request that includes Weekly variables always uses JSON.

Error handling

By default a failed request returns null. Set RethrowExceptions to get an exception instead. API errors are thrown as OpenMeteoClientException, which carries the HTTP status code and the reason reported by the API.

var client = new OpenMeteoClient { RethrowExceptions = true };

try
{
    var forecast = await client.QueryWeatherApiAsync(options);
}
catch (OpenMeteoClientException ex)
{
    Console.WriteLine($"{ex.StatusCode}: {ex.Message}");
}

More usage examples are in the tests.

🗂️ Scripts

Script Description
Scripts/Generate-RegionalCoverageClasses.ps1 Reads each .geojson boundary file under OpenMeteo/Weather/Forecast/RegionalModelCoverage/ and regenerates the corresponding *Coverage.cs static C# class. Re-run this script and commit the output whenever a GeoJSON boundary file is added or updated.

🤝 Contributing

Contributions are welcome. Please read the contributing guide first, and make sure dotnet test passes before you open a pull request.

License

This project is open-source under the MIT license.

Appendix

This library uses the public and freely available Open-Meteo API servers. See also:

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.14.3 164 11/16/2026
5.14.2 94 11/16/2026
5.14.1 105 11/15/2026
5.14.0 103 11/15/2026
5.13.0 108 11/15/2026
5.12.5 118 11/15/2026
5.12.4 176 11/7/2026
5.11.0 251 10/14/2026
5.10.2 238 9/22/2026
5.9.3 673 5/31/2026
5.9.2 748 4/23/2026
5.8.3 139 4/23/2026
5.6.1 188 3/20/2026
Loading failed