Skip to content

Commit

Permalink
more linting
Browse files Browse the repository at this point in the history
  • Loading branch information
randytpierce committed Sep 13, 2024
1 parent 86921e5 commit c10fe37
Show file tree
Hide file tree
Showing 23 changed files with 95 additions and 76 deletions.
3 changes: 2 additions & 1 deletion src/vxingest/ctc_to_cb/ctc_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from couchbase.exceptions import DocumentNotFoundException, TimeoutException
from couchbase.search import GeoBoundingBoxQuery, SearchOptions

from vxingest.builder_common.builder import Builder
from vxingest.builder_common.builder_utilities import (
convert_to_iso,
Expand All @@ -41,7 +42,7 @@ class CTCBuilder(Builder):
geo.top_left.lon as tl_lon
FROM `{self.bucket}`.{self.scope}.{self.collection}
WHERE type="MD" and docType="region" and subset='COMMON' and version='V01' and name="ALL_HRRR"
use the boubnding box to select stations for the region
use the bounding box to select stations for the region
[
{
"bottom_right": {
Expand Down
1 change: 1 addition & 0 deletions src/vxingest/grib2_to_cb/grib_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from pathlib import Path

import numpy as np

from vxingest.builder_common.builder_utilities import get_geo_index
from vxingest.grib2_to_cb.grib_builder_parent import GribBuilder

Expand Down
1 change: 1 addition & 0 deletions src/vxingest/grib2_to_cb/grib_builder_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import pyproj
import xarray as xr

from vxingest.builder_common.builder import Builder
from vxingest.builder_common.builder_utilities import (
convert_to_iso,
Expand Down
1 change: 1 addition & 0 deletions src/vxingest/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
QueryOptions,
)
from prometheus_client import CollectorRegistry, Counter, Gauge, write_to_textfile

from vxingest.ctc_to_cb.run_ingest_threads import VXIngest as CTCIngest
from vxingest.grib2_to_cb.run_ingest_threads import VXIngest as GRIBIngest
from vxingest.log_config import (
Expand Down
1 change: 1 addition & 0 deletions src/vxingest/netcdf_to_cb/netcdf_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import numpy.ma as ma
from metpy.calc import relative_humidity_from_dewpoint, wind_components
from metpy.units import units

from vxingest.builder_common.builder import Builder
from vxingest.builder_common.builder_utilities import (
convert_to_iso,
Expand Down
1 change: 1 addition & 0 deletions src/vxingest/partial_sums_to_cb/partial_sums_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from couchbase.search import GeoBoundingBoxQuery, SearchOptions
from metpy.calc import relative_humidity_from_dewpoint, wind_components
from metpy.units import units

from vxingest.builder_common.builder import Builder
from vxingest.builder_common.builder_utilities import (
convert_to_iso,
Expand Down
1 change: 1 addition & 0 deletions tests/vxingest/builder_common/test_bc_builder_utilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest

from vxingest.builder_common.builder_utilities import (
convert_to_iso,
get_geo_index,
Expand Down
20 changes: 11 additions & 9 deletions tests/vxingest/builder_common/test_unit_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from couchbase.auth import PasswordAuthenticator
from couchbase.cluster import Cluster
from couchbase.options import ClusterOptions, ClusterTimeoutOptions, QueryOptions

from vxingest.grib2_to_cb.run_ingest_threads import VXIngest


Expand Down Expand Up @@ -45,7 +46,7 @@ def connect_cb():
return cb_connection


@pytest.mark.integration()
@pytest.mark.integration
def test_get_file_list(request):
vx_ingest = VXIngest()
vx_ingest.credentials_file = os.environ["CREDENTIALS"]
Expand All @@ -57,13 +58,14 @@ def test_get_file_list(request):
temp_dir_path = "/tmp/vx_ingest"
shutil.rmtree(temp_dir_path, ignore_errors=True)
Path(temp_dir_path).mkdir(parents=True, exist_ok=True)
with Path(temp_dir_path / "2128723000010").open("w") as f:
myPath = Path(temp_dir_path)
with Path(myPath / "2128723000010").open("w") as f:
f.write("test")
with Path.open(Path(temp_dir_path / "2128723000020"), "w") as f:
with Path.open(Path(myPath / "2128723000020"), "w") as f:
f.write("test")
with Path.open(Path(temp_dir_path / "2128723000030"), "w") as f:
with Path.open(Path(myPath / "2128723000030"), "w") as f:
f.write("test")
with Path.open(Path(temp_dir_path, "2128723000040"), "w") as f:
with Path.open(Path(myPath, "2128723000040"), "w") as f:
f.write("test")

file_list = vx_ingest.get_file_list(
Expand All @@ -76,7 +78,7 @@ def test_get_file_list(request):
), f"{request.node.name}: file_list is not reverse sorted"


@pytest.mark.integration()
@pytest.mark.integration
def test_stations_fcst_valid_epoch(request):
_expected_time = 10
_name = request.node.name
Expand All @@ -96,7 +98,7 @@ def test_stations_fcst_valid_epoch(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_stations_get_file_list_grib2(request):
_expected_time = 16
_name = request.node.name
Expand All @@ -114,7 +116,7 @@ def test_stations_get_file_list_grib2(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_stations_get_file_list_netcdf(request):
_expected_time = 5
_name = request.node.name
Expand All @@ -132,7 +134,7 @@ def test_stations_get_file_list_netcdf(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_metar_count(request):
_expected_time = 0.05
_name = request.node.name
Expand Down
13 changes: 7 additions & 6 deletions tests/vxingest/ctc_to_cb/test_int_metar_ctc.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from couchbase.auth import PasswordAuthenticator
from couchbase.cluster import Cluster
from couchbase.options import ClusterOptions, ClusterTimeoutOptions

from vxingest.ctc_to_cb import ctc_builder
from vxingest.ctc_to_cb.run_ingest_threads import VXIngest

Expand All @@ -37,7 +38,7 @@ def stub_worker_log_configurer(queue: Queue):
pass


@pytest.mark.integration()
@pytest.mark.integration
def test_check_fcst_valid_epoch_fcst_valid_iso():
"""
integration test to check fcst_valid_epoch is derived correctly
Expand Down Expand Up @@ -83,7 +84,7 @@ def test_check_fcst_valid_epoch_fcst_valid_iso():
assert (fve % 3600) == 0, "fcstValidEpoch is not at top of hour"


@pytest.mark.integration()
@pytest.mark.integration
def test_get_stations_geo_search():
"""
Currently we know that there are differences between the geo search stations list and the legacy
Expand Down Expand Up @@ -288,7 +289,7 @@ def calculate_cb_ctc(
return ctc


@pytest.mark.integration()
@pytest.mark.integration
def test_ctc_builder_ceiling_hrrr_ops_all_hrrr():
"""
This test verifies that data is returned for each fcstLen and each threshold.
Expand Down Expand Up @@ -380,7 +381,7 @@ def test_ctc_builder_ceiling_hrrr_ops_all_hrrr():
continue


@pytest.mark.integration()
@pytest.mark.integration
def test_ctc_builder_visibility_hrrr_ops_all_hrrr():
"""
This test verifies that data is returned for each fcstLen and each threshold.
Expand Down Expand Up @@ -472,7 +473,7 @@ def test_ctc_builder_visibility_hrrr_ops_all_hrrr():
continue


@pytest.mark.integration()
@pytest.mark.integration
def test_ctc_ceiling_data_hrrr_ops_all_hrrr():
"""
This test is a comprehensive test of the ctcBuilder data. It will retrieve CTC documents
Expand Down Expand Up @@ -605,7 +606,7 @@ def test_ctc_ceiling_data_hrrr_ops_all_hrrr():
the derived CTC {field}: {_ctc_value} and caclulated CTC {field}: {_cb_ctc_value} values do not match"""


@pytest.mark.integration()
@pytest.mark.integration
def test_ctc_visibiltiy_data_hrrr_ops_all_hrrr():
"""
This test is a comprehensive test of the ctcBuilder data. It will retrieve CTC documents
Expand Down
9 changes: 5 additions & 4 deletions tests/vxingest/ctc_to_cb/test_unit_metar_ctc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from multiprocessing import JoinableQueue

import pytest

from vxingest.ctc_to_cb.run_ingest_threads import VXIngest
from vxingest.ctc_to_cb.vx_ingest_manager import VxIngestManager

Expand Down Expand Up @@ -31,7 +32,7 @@ def setup_ingest():
return _vx_ingest, vx_ingest_manager


@pytest.mark.integration()
@pytest.mark.integration
def test_cb_connect_disconnect():
"""test the cb connect and close"""
vx_ingest_manager = None
Expand All @@ -50,7 +51,7 @@ def test_cb_connect_disconnect():
vx_ingest_manager.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_credentials_and_load_spec():
"""test the get_credentials and load_spec"""
vx_ingest_manager = None
Expand All @@ -65,7 +66,7 @@ def test_credentials_and_load_spec():
vx_ingest_manager.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_write_load_job_to_files(tmp_path):
"""test write the load job"""
vx_ingest_manager = None
Expand All @@ -82,7 +83,7 @@ def test_write_load_job_to_files(tmp_path):
vx_ingest_manager.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_build_load_job_doc():
"""test the build load job"""
vx_ingest_manager = None
Expand Down
12 changes: 6 additions & 6 deletions tests/vxingest/ctc_to_cb/test_unit_queries_ctc.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def connect_cb():
return cb_connection


@pytest.mark.integration()
@pytest.mark.integration
def test_epoch_fcstlen_model(request):
_name = request.node.name
_expected_time = 3.0
Expand All @@ -62,7 +62,7 @@ def test_epoch_fcstlen_model(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_epoch_fcstlen_obs(request):
_name = request.node.name
_expected_time = 0.2
Expand All @@ -80,7 +80,7 @@ def test_epoch_fcstlen_obs(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_forecast_valid_epoch(request):
_name = request.node.name
_expected_time = 6.0
Expand All @@ -98,7 +98,7 @@ def test_forecast_valid_epoch(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_get_region_lat_lon(request):
_name = request.node.name
_expected_time = 0.01
Expand All @@ -116,7 +116,7 @@ def test_get_region_lat_lon(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_get_stations(request):
_name = request.node.name
_expected_time = 3
Expand All @@ -134,7 +134,7 @@ def test_get_stations(request):
), f"{_name}: elasped_time greater than {_expected_time} {elapsed_time}"


@pytest.mark.integration()
@pytest.mark.integration
def test_get_threshold_descriptions(request):
_name = request.node.name
_expected_time = 0.6
Expand Down
7 changes: 4 additions & 3 deletions tests/vxingest/grib2_to_cb/test_int_metar_model_grib.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from couchbase.auth import PasswordAuthenticator
from couchbase.cluster import Cluster
from couchbase.options import ClusterOptions, ClusterTimeoutOptions

from vxingest.grib2_to_cb.run_ingest_threads import VXIngest

cb_connection = {}
Expand Down Expand Up @@ -64,7 +65,7 @@ def connect_cb():
return cb_connection


@pytest.mark.integration()
@pytest.mark.integration
def test_grib_builder_one_thread_file_pattern_hrrr_ops_conus(tmp_path):
"""test gribBuilder with one thread.
This test verifies the resulting data file against the one that is in couchbase already
Expand Down Expand Up @@ -175,7 +176,7 @@ def test_grib_builder_one_thread_file_pattern_hrrr_ops_conus(tmp_path):
{_k}.{_dk} {result['data'][_k][_dk]} != {_json['data'][_k][_dk]} within {abs_tol} decimal places."""


@pytest.mark.integration()
@pytest.mark.integration
def test_grib_builder_two_threads_file_pattern_hrrr_ops_conus(tmp_path):
"""test gribBuilder multi-threaded
Not going to qulify the data on this one, just make sure it runs two threads properly
Expand Down Expand Up @@ -207,7 +208,7 @@ def test_grib_builder_two_threads_file_pattern_hrrr_ops_conus(tmp_path):
)


@pytest.mark.integration()
@pytest.mark.integration
def test_grib_builder_two_threads_file_pattern_rap_ops_130_conus(tmp_path):
"""test gribBuilder multi-threaded
Not going to qulify the data on this one, just make sure it runs two threads properly
Expand Down
13 changes: 7 additions & 6 deletions tests/vxingest/grib2_to_cb/test_unit_metar_model_grib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path

import pytest

from vxingest.grib2_to_cb.run_ingest_threads import VXIngest


Expand Down Expand Up @@ -29,7 +30,7 @@ def setup_connection():
return _vx_ingest


@pytest.mark.integration()
@pytest.mark.integration
def test_credentials_and_load_spec():
"""test the get_credentials and load_spec"""
vx_ingest = None
Expand All @@ -42,7 +43,7 @@ def test_credentials_and_load_spec():
vx_ingest.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_credentials_and_load_spec_multiple_ingest_ids():
"""test the get_credentials and load_spec"""
vx_ingest = None
Expand All @@ -55,7 +56,7 @@ def test_credentials_and_load_spec_multiple_ingest_ids():
vx_ingest.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_cb_connect_disconnect():
"""test the cb connect and close"""
vx_ingest = None
Expand All @@ -71,7 +72,7 @@ def test_cb_connect_disconnect():
vx_ingest.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_write_load_job_to_files(tmp_path):
"""test write the load job"""
vx_ingest = None
Expand All @@ -87,7 +88,7 @@ def test_write_load_job_to_files(tmp_path):
vx_ingest.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_build_load_job_doc(tmp_path):
"""test the build load job"""
vx_ingest = None
Expand All @@ -107,7 +108,7 @@ def test_build_load_job_doc(tmp_path):
vx_ingest.close_cb()


@pytest.mark.integration()
@pytest.mark.integration
def test_vxingest_get_file_list(tmp_path):
"""test the vxingest get_file_list"""
vx_ingest = None
Expand Down
Loading

0 comments on commit c10fe37

Please sign in to comment.