Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new observation attributes. #12

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Observation/Pressure.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@ final class Pressure {
*/
protected ?int $meanSeaLevel = NULL;

/**
* The pressure, in hectopascals.
*/
protected ?float $pressure = NULL;

/**
* Gets the pressure in hectopascals.
*/
public function getPressure(): ?float {
return $this->pressure;
}

/**
* Sets the pressure in hectopascals.
*/
public function setPressure(?float $pressure): Pressure {
$this->pressure = $pressure;
return $this;
}

/**
* Gets the PressureQnh.
*/
Expand Down
4 changes: 3 additions & 1 deletion src/Observation/Serializer/ObservationListNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ public function denormalize($data, $type, $format = NULL, array $context = []) {
}

$observationList = new ObservationList();
$observationList->setRefreshMessage($data['observations']['header'][0]['refresh_message']);
if (\array_key_exists('header', $data['observations'])) {
$observationList->setRefreshMessage($data['observations']['header'][0]['refresh_message']);
}

\array_map(function ($observationData) use ($observationList): void {
$observationList->addObservation($this->serializer->denormalize($observationData, Observation::class));
Expand Down
40 changes: 40 additions & 0 deletions src/Observation/Station.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ final class Station {
*/
protected ?float $longitude = NULL;

/**
* The station ID.
*/
protected ?int $wmoId = NULL;

/**
* The station ID.
*/
protected string|int|null $bomId = NULL;

/**
* Gets the Name.
*/
Expand Down Expand Up @@ -89,4 +99,34 @@ public function setId(int $id): self {
return $this;
}

/**
* Gets the BOM ID.
*/
public function getBomId(): ?int {
return $this->bomId;
}

/**
* Sets the BOM ID.
*/
public function setBomId(string|int $id): self {
$this->bomId = $id;
return $this;
}

/**
* Gets the WMO ID.
*/
public function getWmoId(): ?int {
return $this->wmoId;
}

/**
* Sets the Wmo ID.
*/
public function setWmoId(int $id): self {
$this->wmoId = $id;
return $this;
}

}
40 changes: 40 additions & 0 deletions src/Observation/Temperature.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ final class Temperature {
*/
protected ?float $airTemp = NULL;

/**
* The maximum air temperature, in Celsius.
*/
protected ?float $maximumAirTemp = NULL;

/**
* The minimum air temperature, in Celsius.
*/
protected ?float $minimumAirTemp = NULL;

/**
* The apparent temperature, in Celsius.
*/
Expand Down Expand Up @@ -49,6 +59,36 @@ public function setAirTemp(float $airTemp): Temperature {
return $this;
}

/**
* Gets the maximum AirTemp.
*/
public function getMaximumAirTemp(): ?float {
return $this->maximumAirTemp;
}

/**
* Sets the maximum AirTemp.
*/
public function setMaximumAirTemp(float $airTemp): Temperature {
$this->maximumAirTemp = $airTemp;
return $this;
}

/**
* Gets the minimum AirTemp.
*/
public function getMinimumAirTemp(): ?float {
return $this->minimumAirTemp;
}

/**
* Sets the minimum AirTemp.
*/
public function setMinimumAirTemp(float $airTemp): Temperature {
$this->minimumAirTemp = $airTemp;
return $this;
}

/**
* Gets the ApparentTemp.
*/
Expand Down
80 changes: 80 additions & 0 deletions src/Observation/Wind.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,71 @@ final class Wind {
*/
protected ?int $gustKnots = NULL;

/**
* The wind gusts, in kilometres per Hour.
*/
protected ?int $maximumGustKmh = NULL;

/**
* The wind gusts, in knots.
*/
protected ?int $maximumGustSpeed = NULL;

/**
* The wind gusts, in knots.
*/
protected ?string $maximumGustDirection = NULL;

/**
* The wind direction in degree.
*/
protected ?int $windDirectionDegree = NULL;

/**
* Gets the maximum gust speed in kilometers per hour.
*/
public function getMaximumGustKmh(): ?int {
return $this->maximumGustKmh;
}

/**
* Set the maximum gust speed in kilometers per hour.
*/
public function setMaximumGustKmh(?int $maximumGustKmh): Wind {
$this->maximumGustKmh = $maximumGustKmh;
return $this;
}

/**
* Gets the maximum gust speed in knots.
*/
public function getMaximumGustSpeed(): ?int {
return $this->maximumGustSpeed;
}

/**
* Sets the maximum gust speed in knots.
*/
public function setMaximumGustSpeed(?int $maximumGustSpeed): Wind {
$this->maximumGustSpeed = $maximumGustSpeed;
return $this;
}

/**
* Sets the maximum gust direction.
*/
public function getMaximumGustDirection(): ?string {
return $this->maximumGustDirection;
}

/**
* Gets the maximum gust direction.
*/
public function setMaximumGustDirection(string $maximumGustDirection): Wind {
$this->maximumGustDirection = $maximumGustDirection;
return $this;
}

/**
* Gets the Direction.
*/
Expand Down Expand Up @@ -109,4 +174,19 @@ public function setGustKnots(int $gustKnots): Wind {
return $this;
}

/**
* Gets the wind direction in degree.
*/
public function getWindDirectionDegree(): ?int {
return $this->windDirectionDegree;
}

/**
* Sets the wind direction in degree.
*/
public function setWindDirectionDegree(int $gustKnots): Wind {
$this->windDirectionDegree = $gustKnots;
return $this;
}

}