Clapsode.DataLayerTS.WeatherDataLoader 0.9.49

dotnet add package Clapsode.DataLayerTS.WeatherDataLoader --version 0.9.49
NuGet\Install-Package Clapsode.DataLayerTS.WeatherDataLoader -Version 0.9.49
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="Clapsode.DataLayerTS.WeatherDataLoader" Version="0.9.49" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Clapsode.DataLayerTS.WeatherDataLoader --version 0.9.49
#r "nuget: Clapsode.DataLayerTS.WeatherDataLoader, 0.9.49"
#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.
// Install Clapsode.DataLayerTS.WeatherDataLoader as a Cake Addin
#addin nuget:?package=Clapsode.DataLayerTS.WeatherDataLoader&version=0.9.49

// Install Clapsode.DataLayerTS.WeatherDataLoader as a Cake Tool
#tool nuget:?package=Clapsode.DataLayerTS.WeatherDataLoader&version=0.9.49

Ingestion Manager for Loading Weather Forecasts from the DWD into Data Layer TS

This library can be used to ingest weather forecasts from the DWD into a Data Layer TS instance. The data can be used for forecasting any time series, which is dependent on the local weather (e.g. photovoltaic panel or wind turbine power production).

Purpose

The DWD (Deutscher Wetterdienst - german national weather forecasting service) offers weather forecasts for free (fully commercial use allowed), but overwrites the data every 24 hours. The scheduler currently supports loading data from the ICON-D2 (scope Germany) and the ICON-EU (scope Europe) grids of the ICON model. The ICON-D2 and the ICON-EU grid/model forecasts are estimated and published every 3 hours. There are more than one hundred different weather variables available and some of them are available on different vertical levels. The data is stored in a way where each (GRIB2) file contains all available grid-points (hundreds of thousands of grid-points) and only 1 hour of time steps. If the data should be used to train models, run forecasts or analyze historical data, the data is needed in different form - many time steps (also more than 24 hours) are needed for just one or a few grid-points. Data Layer TS is a high-performance time-series database technology which enables storing this data and making it available in the right form using a simple RESTful HTTP API. Currently it is available in the Microsoft Azure Marketplace exclusively.

Requirements

The library needs .Net 7 or .Net 8 to work and the license only grants use, if the library is used with an own Data Layer TS instance.

Configuration

The IngestionScheduler needs a SchedulerConfiguration to be initialized. The most important part of this configuration is the target Data Layer TS instance URL and credentials. The IngestionScheduler can either load continuously until it is canceled or just load data until no more data can be found and then stop (although new data is available every three hours). It can be started using a SchedulingRequest with two main parameters: The weather variables (ContentConfiguration), which should be loaded and the coordinates that should be extracted from the weather variable files. Instead of giving this information to the IngestionScheduler directly, it can also be configured to load all the stored variables and coordinates from the configured ILoadingConfigurationRepository, which is the target Data Layer TS instance per default and extend the configuration to continue loading these series. It will then load all the coordinates for all the variables - if any new variable is created in the target Data Layer TS instance, a background job will pick up the changes and start to load the data without any restart. The state of the processing scheduler is stored using the IProcessingHistoryRepository, which per default uses local files on disk, but since Data Layer TS write operations do not really depend on the number of time steps ingested, but rather on the number of time series ingested, a cold-start (no state stored) is not very expensive. The target Data Layer TS instance IOPS will most likely be the bottleneck and the scheduler should be configured to run as few parallel ingestions as possible while keeping the Data Layer TS IOPS at nearly 100%. This ensures maximum ingestion-throughput while keeping the read-throughput capability high.

Example Usage

In this usage example an ILogger and a TraceProvider is added and one example coordinate is loaded from both the ICON-EU and the ICON-D2 model:

using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
{
	builder.AddFilter("Microsoft", LogLevel.Warning)
			.AddFilter("System", LogLevel.Warning)
			.AddFilter("IconLoaderDLTS", LogLevel.Information)
			.AddSimpleConsole(c => c.TimestampFormat = "[HH:mm:ss]");
});
ILogger logger = loggerFactory.CreateLogger("IconLoaderDLTS");

using TracerProvider tracerProvider = Sdk.CreateTracerProviderBuilder()
			.SetResourceBuilder(ResourceBuilder.CreateDefault().AddService("IconLoaderDLTS"))
			.AddSource("Clapsode.DataLayerTS.WeatherDataLoader")
			.AddConsoleExporter()
			.Build();

await using IngestionScheduler ingestionScheduler = new(baseConfiguration, logger);

Dictionary<NumericalWeatherPredictionModel, HashSet<Coordinate>> coordsToLoad = new();
coordsToLoad.Add(NumericalWeatherPredictionModel.ICON_D2, new HashSet<Coordinate>() { new Coordinate(51.5, 6.75) });
coordsToLoad[NumericalWeatherPredictionModel.ICON_D2].Add(new Coordinate(55, 7.1));
coordsToLoad.Add(NumericalWeatherPredictionModel.ICON_EU, new HashSet<Coordinate>() { new Coordinate(51.5, 6.75) });
coordsToLoad[NumericalWeatherPredictionModel.ICON_EU].Add(new Coordinate(55, 7.1));

HashSet<ContentConfiguration> contentToLoad = new();
contentToLoad.Add(new(NumericalWeatherPredictionModel.ICON_D2, LevelType.MODEL_LEVEL, 60, "p", TimeSpan.FromMinutes(60)));

SchedulingRequest request = new()
{
	RunContinuously = true,
	ConfigurationsToLoad = contentToLoad,
	CoordinatesToLoad = coordsToLoad,
	CoordinateMapping = CoordinateMapping.MAP_TO_SURROUNDING_FOUR,
	ExtendCoordinatesWithRepository = false,
	ExtendConfigurationsWithRepository = false,
};

await ingestionScheduler.RunAsync(request).ConfigureAwait(false);
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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. 
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
0.9.49 45 4/25/2024
0.9.48 46 4/24/2024
0.9.47 92 4/23/2024
0.9.46 112 4/17/2024
0.9.45 81 4/17/2024
0.9.44 84 4/16/2024
0.9.43 120 4/15/2024
0.9.42 92 4/15/2024
0.9.41 84 4/15/2024
0.9.40 73 4/15/2024
0.9.39 82 4/15/2024
0.9.38 82 4/14/2024
0.9.37 75 4/13/2024
0.9.36 218 4/12/2024
0.9.35 93 4/12/2024
0.9.34 73 4/11/2024
0.9.33 79 4/11/2024
0.9.32 91 4/11/2024
0.9.31 83 4/11/2024
0.9.30 83 4/10/2024
0.9.29 90 4/9/2024
0.9.28 77 4/8/2024
0.9.27 83 4/8/2024
0.9.26 145 3/25/2024
0.9.25 115 3/19/2024
0.9.24 325 2/6/2024
0.9.23 87 2/2/2024
0.9.22 82 2/2/2024
0.9.21 81 1/31/2024
0.9.20 77 1/30/2024
0.9.19 74 1/30/2024
0.9.18 81 1/29/2024
0.9.17 75 1/29/2024
0.9.16 73 1/29/2024
0.9.15 75 1/29/2024
0.9.14 86 1/29/2024
0.9.13 81 1/26/2024
0.9.12 74 1/26/2024
0.9.11 77 1/26/2024
0.9.10 85 1/23/2024
0.9.9 78 1/23/2024
0.9.8 117 1/21/2024
0.9.7 76 1/19/2024
0.9.6 78 1/19/2024
0.9.5 75 1/18/2024
0.9.4 77 1/18/2024
0.9.3 82 1/18/2024
0.9.2 95 1/17/2024
0.9.1 95 1/16/2024
0.9.0 87 1/15/2024