Skip to content

Commit

Permalink
feat: pressure levels + sync methods (#17)
Browse files Browse the repository at this point in the history
* feat: sync methods for async counterparts

* test: add unit test for sync methods

* Test: refactoring

* feat: support for pressure levels
  • Loading branch information
AlienDwarf authored Sep 10, 2022
1 parent 94d5739 commit b8b49fc
Show file tree
Hide file tree
Showing 6 changed files with 479 additions and 34 deletions.
138 changes: 137 additions & 1 deletion OpenMeteo/Hourly.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json;

namespace OpenMeteo
{
Expand Down Expand Up @@ -48,12 +49,147 @@ public class Hourly
public float[]? Shortwave_radiation { get; set; }
public float[]? Direct_radiation { get; set; }
public float[]? Diffuse_radiation { get; set; }
public float?[]? Direct_normal_irradiance { get; set; } // Issue created https://github.com/open-meteo/open-meteo/issues/114
public float[]? Direct_normal_irradiance { get; set; } // Issue created https://github.com/open-meteo/open-meteo/issues/114
public float[]? Terrestrial_radiation { get; set; }
public float[]? Shortwave_radiation_instant { get; set; }
public float[]? Direct_radiation_instant { get; set; }
public float[]? Diffuse_radiation_instant { get; set; }
public float[]? Direct_normal_irradiance_instant { get; set; }
public float[]? Terrestrial_radiation_instant { get; set; }

// Open-Meteo v0.0.74 - Pressure Levels
public float?[]? Temperature_1000hPa { get; set; }
public float?[]? Temperature_975hPa { get; set; }
public float?[]? Temperature_950hPa { get; set; }
public float?[]? Temperature_925hPa { get; set; }
public float?[]? Temperature_900hPa { get; set; }
public float?[]? Temperature_850hPa { get; set; }
public float?[]? Temperature_800hPa { get; set; }
public float?[]? Temperature_700hPa { get; set; }
public float?[]? Temperature_600hPa { get; set; }
public float?[]? Temperature_500hPa { get; set; }
public float?[]? Temperature_400hPa { get; set; }
public float?[]? Temperature_300hPa { get; set; }
public float?[]? Temperature_250hPa { get; set; }
public float?[]? Temperature_200hPa { get; set; }
public float?[]? Temperature_150hPa { get; set; }
public float?[]? Temperature_100hPa { get; set; }
public float?[]? Temperature_70hPa { get; set; }
public float?[]? Temperature_50hPa { get; set; }
public float?[]? Temperature_30hPa { get; set; }
public float?[]? Dewpoint_1000hPa { get; set; }
public float?[]? Dewpoint_975hPa { get; set; }
public float?[]? Dewpoint_950hPa { get; set; }
public float?[]? Dewpoint_925hPa { get; set; }
public float?[]? Dewpoint_900hPa { get; set; }
public float?[]? Dewpoint_850hPa { get; set; }
public float?[]? Dewpoint_800hPa { get; set; }
public float?[]? Dewpoint_700hPa { get; set; }
public float?[]? Dewpoint_600hPa { get; set; }
public float?[]? Dewpoint_500hPa { get; set; }
public float?[]? Dewpoint_400hPa { get; set; }
public float?[]? Dewpoint_300hPa { get; set; }
public float?[]? Dewpoint_250hPa { get; set; }
public float?[]? Dewpoint_200hPa { get; set; }
public float?[]? Dewpoint_150hPa { get; set; }
public float?[]? Dewpoint_100hPa { get; set; }
public float?[]? Dewpoint_70hPa { get; set; }
public float?[]? Dewpoint_50hPa { get; set; }
public float?[]? Dewpoint_30hPa { get; set; }
public float?[]? Relativehumidity_1000hPa { get; set; }
public float?[]? Relativehumidity_975hPa { get; set; }
public float?[]? Relativehumidity_950hPa { get; set; }
public float?[]? Relativehumidity_925hPa { get; set; }
public float?[]? Relativehumidity_900hPa { get; set; }
public float?[]? Relativehumidity_850hPa { get; set; }
public float?[]? Relativehumidity_800hPa { get; set; }
public float?[]? Relativehumidity_700hPa { get; set; }
public float?[]? Relativehumidity_600hPa { get; set; }
public float?[]? Relativehumidity_500hPa { get; set; }
public float?[]? Relativehumidity_400hPa { get; set; }
public float?[]? Relativehumidity_300hPa { get; set; }
public float?[]? Relativehumidity_250hPa { get; set; }
public float?[]? Relativehumidity_200hPa { get; set; }
public float?[]? Relativehumidity_150hPa { get; set; }
public float?[]? Relativehumidity_100hPa { get; set; }
public float?[]? Relativehumidity_70hPa { get; set; }
public float?[]? Relativehumidity_50hPa { get; set; }
public float?[]? Relativehumidity_30hPa { get; set; }
public float?[]? Cloudcover_1000hPa { get; set; }
public float?[]? Cloudcover_975hPa { get; set; }
public float?[]? Cloudcover_950hPa { get; set; }
public float?[]? Cloudcover_925hPa { get; set; }
public float?[]? Cloudcover_900hPa { get; set; }
public float?[]? Cloudcover_850hPa { get; set; }
public float?[]? Cloudcover_800hPa { get; set; }
public float?[]? Cloudcover_700hPa { get; set; }
public float?[]? Cloudcover_600hPa { get; set; }
public float?[]? Cloudcover_500hPa { get; set; }
public float?[]? Cloudcover_400hPa { get; set; }
public float?[]? Cloudcover_300hPa { get; set; }
public float?[]? Cloudcover_250hPa { get; set; }
public float?[]? Cloudcover_200hPa { get; set; }
public float?[]? Cloudcover_150hPa { get; set; }
public float?[]? Cloudcover_100hPa { get; set; }
public float?[]? Cloudcover_70hPa { get; set; }
public float?[]? Cloudcover_50hPa { get; set; }
public float?[]? Cloudcover_30hPa { get; set; }
public float?[]? Windspeed_1000hPa { get; set; }
public float?[]? Windspeed_975hPa { get; set; }
public float?[]? Windspeed_950hPa { get; set; }
public float?[]? Windspeed_925hPa { get; set; }
public float?[]? Windspeed_900hPa { get; set; }
public float?[]? Windspeed_850hPa { get; set; }
public float?[]? Windspeed_800hPa { get; set; }
public float?[]? Windspeed_700hPa { get; set; }
public float?[]? Windspeed_600hPa { get; set; }
public float?[]? Windspeed_500hPa { get; set; }
public float?[]? Windspeed_400hPa { get; set; }
public float?[]? Windspeed_300hPa { get; set; }
public float?[]? Windspeed_250hPa { get; set; }
public float?[]? Windspeed_200hPa { get; set; }
public float?[]? Windspeed_150hPa { get; set; }
public float?[]? Windspeed_100hPa { get; set; }
public float?[]? Windspeed_70hPa { get; set; }
public float?[]? Windspeed_50hPa { get; set; }
public float?[]? Windspeed_30hPa { get; set; }
public float?[]? Winddirection_1000hPa { get; set; }
public float?[]? Winddirection_975hPa { get; set; }
public float?[]? Winddirection_950hPa { get; set; }
public float?[]? Winddirection_925hPa { get; set; }
public float?[]? Winddirection_900hPa { get; set; }
public float?[]? Winddirection_850hPa { get; set; }
public float?[]? Winddirection_800hPa { get; set; }
public float?[]? Winddirection_700hPa { get; set; }
public float?[]? Winddirection_600hPa { get; set; }
public float?[]? Winddirection_500hPa { get; set; }
public float?[]? Winddirection_400hPa { get; set; }
public float?[]? Winddirection_300hPa { get; set; }
public float?[]? Winddirection_250hPa { get; set; }
public float?[]? Winddirection_200hPa { get; set; }
public float?[]? Winddirection_150hPa { get; set; }
public float?[]? Winddirection_100hPa { get; set; }
public float?[]? Winddirection_70hPa { get; set; }
public float?[]? Winddirection_50hPa { get; set; }
public float?[]? Winddirection_30hPa { get; set; }
public float?[]? Geopotential_height_1000hPa { get; set; }
public float?[]? Geopotential_height_975hPa { get; set; }
public float?[]? Geopotential_height_950hPa { get; set; }
public float?[]? Geopotential_height_925hPa { get; set; }
public float?[]? Geopotential_height_900hPa { get; set; }
public float?[]? Geopotential_height_850hPa { get; set; }
public float?[]? Geopotential_height_800hPa { get; set; }
public float?[]? Geopotential_height_700hPa { get; set; }
public float?[]? Geopotential_height_600hPa { get; set; }
public float?[]? Geopotential_height_500hPa { get; set; }
public float?[]? Geopotential_height_400hPa { get; set; }
public float?[]? Geopotential_height_300hPa { get; set; }
public float?[]? Geopotential_height_250hPa { get; set; }
public float?[]? Geopotential_height_200hPa { get; set; }
public float?[]? Geopotential_height_150hPa { get; set; }
public float?[]? Geopotential_height_100hPa { get; set; }
public float?[]? Geopotential_height_70hPa { get; set; }
public float?[]? Geopotential_height_50hPa { get; set; }
public float?[]? Geopotential_height_30hPa { get; set; }
}
}
167 changes: 137 additions & 30 deletions OpenMeteo/HourlyOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,7 @@ public class HourlyOptions : IEnumerable<HourlyOptionsParameter>, ICollection<Ho
};

private readonly List<HourlyOptionsParameter> _parameter = new List<HourlyOptionsParameter>();
/*public HourlyOptions(string[] parameter)
{
foreach (string s in parameter)
{
if (!IsValidParameter(s.ToLower()))
throw new ArgumentException();
var toAdd = HourlyOptionsStringToEnum(s);
if (toAdd != null)
this._parameter.Add(toAdd);
}
}

public HourlyOptions(string parameter)
{
string s = parameter.ToLower();
if (!IsValidParameter(s))
throw new ArgumentException();
this._parameter.Add(s);
}
*/
public HourlyOptions(HourlyOptionsParameter parameter)
{
Add(parameter);
Expand Down Expand Up @@ -154,14 +134,6 @@ IEnumerator IEnumerable.GetEnumerator()
return this.GetEnumerator();
}

/*public void Add(string item)
{
// Make sure that item is a valid parameter
if (!IsValidParameter(item)) return;
_parameter.Add(item);
}*/

public void Clear()
{
_parameter.Clear();
Expand Down Expand Up @@ -210,7 +182,7 @@ public bool Remove(HourlyOptionsParameter item)
// https://open-meteo.com/en/docs #Hourly Parameter Definition
public enum HourlyOptionsParameter
{
temperature_2m,
temperature_2m,
relativehumidity_2m,
dewpoint_2m,
apparent_temperature,
Expand Down Expand Up @@ -257,6 +229,141 @@ public enum HourlyOptionsParameter
direct_radiation_instant,
diffuse_radiation_instant,
direct_normal_irradiance_instant,
terrestrial_radiation_instant
terrestrial_radiation_instant,

// Open-Meteo Version 0.0.74 - Pressure Levels
temperature_1000hPa,
temperature_975hPa,
temperature_950hPa,
temperature_925hPa,
temperature_900hPa,
temperature_850hPa,
temperature_800hPa,
temperature_700hPa,
temperature_600hPa,
temperature_500hPa,
temperature_400hPa,
temperature_300hPa,
temperature_250hPa,
temperature_200hPa,
temperature_150hPa,
temperature_100hPa,
temperature_70hPa,
temperature_50hPa,
temperature_30hPa,
dewpoint_1000hPa,
dewpoint_975hPa,
dewpoint_950hPa,
dewpoint_925hPa,
dewpoint_900hPa,
dewpoint_850hPa,
dewpoint_800hPa,
dewpoint_700hPa,
dewpoint_600hPa,
dewpoint_500hPa,
dewpoint_400hPa,
dewpoint_300hPa,
dewpoint_250hPa,
dewpoint_200hPa,
dewpoint_150hPa,
dewpoint_100hPa,
dewpoint_70hPa,
dewpoint_50hPa,
dewpoint_30hPa,
relativehumidity_1000hPa,
relativehumidity_975hPa,
relativehumidity_950hPa,
relativehumidity_925hPa,
relativehumidity_900hPa,
relativehumidity_850hPa,
relativehumidity_800hPa,
relativehumidity_700hPa,
relativehumidity_600hPa,
relativehumidity_500hPa,
relativehumidity_400hPa,
relativehumidity_300hPa,
relativehumidity_250hPa,
relativehumidity_200hPa,
relativehumidity_150hPa,
relativehumidity_100hPa,
relativehumidity_70hPa,
relativehumidity_50hPa,
relativehumidity_30hPa,
cloudcover_1000hPa,
cloudcover_975hPa,
cloudcover_950hPa,
cloudcover_925hPa,
cloudcover_900hPa,
cloudcover_850hPa,
cloudcover_800hPa,
cloudcover_700hPa,
cloudcover_600hPa,
cloudcover_500hPa,
cloudcover_400hPa,
cloudcover_300hPa,
cloudcover_250hPa,
cloudcover_200hPa,
cloudcover_150hPa,
cloudcover_100hPa,
cloudcover_70hPa,
cloudcover_50hPa,
cloudcover_30hPa,
windspeed_1000hPa,
windspeed_975hPa,
windspeed_950hPa,
windspeed_925hPa,
windspeed_900hPa,
windspeed_850hPa,
windspeed_800hPa,
windspeed_700hPa,
windspeed_600hPa,
windspeed_500hPa,
windspeed_400hPa,
windspeed_300hPa,
windspeed_250hPa,
windspeed_200hPa,
windspeed_150hPa,
windspeed_100hPa,
windspeed_70hPa,
windspeed_50hPa,
windspeed_30hPa,
winddirection_1000hPa,
winddirection_975hPa,
winddirection_950hPa,
winddirection_925hPa,
winddirection_900hPa,
winddirection_850hPa,
winddirection_800hPa,
winddirection_700hPa,
winddirection_600hPa,
winddirection_500hPa,
winddirection_400hPa,
winddirection_300hPa,
winddirection_250hPa,
winddirection_200hPa,
winddirection_150hPa,
winddirection_100hPa,
winddirection_70hPa,
winddirection_50hPa,
winddirection_30hPa,
geopotential_height_1000hPa,
geopotential_height_975hPa,
geopotential_height_950hPa,
geopotential_height_925hPa,
geopotential_height_900hPa,
geopotential_height_850hPa,
geopotential_height_800hPa,
geopotential_height_700hPa,
geopotential_height_600hPa,
geopotential_height_500hPa,
geopotential_height_400hPa,
geopotential_height_300hPa,
geopotential_height_250hPa,
geopotential_height_200hPa,
geopotential_height_150hPa,
geopotential_height_100hPa,
geopotential_height_70hPa,
geopotential_height_50hPa,
geopotential_height_30hPa
}
}
Loading

0 comments on commit b8b49fc

Please sign in to comment.