Skip to content

Commit

Permalink
Changed area query output to percent
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanHydrogen committed Aug 9, 2024
1 parent 5c03768 commit 24a9850
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Returns the cloud fraction within the requested great circle.
| Field | Type | Description |
|----------|-------|--------------------------------------------------|
| obs_time | float | Observation Unix time of the last analyzed image |
| value | float | Cloud fraction in the requested area |
| value | float | Cloud fraction in the requested area in percent |


## Configuration
Expand Down
2 changes: 1 addition & 1 deletion day_integration_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ modules:
total_fraction: 0.7
zenith_fraction: 0.02
zenith_value: False
zenith_average: 0.02
zenith_average: 2.3

comm:
class: pyobs.comm.local.LocalComm
Expand Down
4 changes: 2 additions & 2 deletions pyobs_cloudcover/testing/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ async def _check_point_query(self, url: str, port: int) -> None:
async with session.get(f"http://{url}:{port}/query/point?az=0.0&alt=90.0") as resp:
data = await resp.json()

np.testing.assert_almost_equal(data["value"], self._zenith_value, 2, err_msg="Wrong point query result!")
np.testing.assert_almost_equal(data["value"], self._zenith_value, 1, err_msg="Wrong point query result!")

async def _check_area_query(self, url: str, port: int) -> None:
async with aiohttp.ClientSession() as session:
async with session.get(f"http://{url}:{port}/query/area?az=0.0&alt=90.0&radius=10.0") as resp:
data = await resp.json()

np.testing.assert_almost_equal(data["value"], self._zenith_average, 2, err_msg="Wrong area query result!")
np.testing.assert_almost_equal(data["value"], self._zenith_average, 1, err_msg="Wrong area query result!")
3 changes: 2 additions & 1 deletion pyobs_cloudcover/web_api/coverage_query_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ def area_query_altaz(self, alt: float, az: float, radius: float) -> Optional[flo
if cloudiness is None:
return None
else:
return float(cloudiness)
cloud_fraction = 100.0 * float(cloudiness)
return cloud_fraction
2 changes: 1 addition & 1 deletion tests/unit/web_api/test_coverage_query_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_area_radec(observer, obs_time) -> None:
cloud_query = SkyPixelQuery([AltAzCoord(0, 0)], [True])
executor.set_measurement(CloudCoverageInfo(cloud_query, 1, 2, 0.1, obs_time))

assert executor.area_query_radec(10, 10, 90) == 1.0
assert executor.area_query_radec(10, 10, 90) == 100.0


def test_area_radec_nan(observer, obs_time) -> None:
Expand Down

0 comments on commit 24a9850

Please sign in to comment.