Skip to content

Commit

Permalink
Use aloftdata bucket
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdesmet committed Aug 22, 2023
1 parent c87c4c3 commit 14cd79f
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/vptstools/bin/transfer_baltrad.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
AWS_SNS_TOPIC = os.environ.get("SNS_TOPIC")
AWS_PROFILE = os.environ.get("AWS_PROFILE", None)
AWS_REGION = os.environ.get("AWS_REGION", None)
DESTINATION_BUCKET = os.environ.get("DESTINATION_BUCKET", "aloft")
DESTINATION_BUCKET = os.environ.get("DESTINATION_BUCKET", "aloftdata")

# Update reporting to SNS functionality
report_sns = partial(report_exception_to_sns,
Expand Down
2 changes: 1 addition & 1 deletion src/vptstools/bin/vph5_to_vpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# (load_dotenv doesn't override existing environment variables)
load_dotenv()

S3_BUCKET = os.environ.get("DESTINATION_BUCKET", "aloft")
INVENTORY_BUCKET = os.environ.get("INVENTORY_BUCKET", "aloft-inventory")
S3_BUCKET = os.environ.get("DESTINATION_BUCKET", "aloftdata")
AWS_SNS_TOPIC = os.environ.get("SNS_TOPIC")
AWS_PROFILE = os.environ.get("AWS_PROFILE", None)
AWS_REGION = os.environ.get("AWS_REGION", "eu-west-1")
Expand Down
2 changes: 1 addition & 1 deletion src/vptstools/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def s3_path_setup(self, file_output):
"""Common setup of the S3 bucket logic"""
return f"{self.source}/{file_output}/{self.radar_code}/{self.year}"

def s3_url_h5(self, bucket="aloft"):
def s3_url_h5(self, bucket="aloftdata"):
"""Full S3 URL for the stored h5 file"""
return (
f"s3://{bucket}/{self.s3_path_setup('hdf5')}/"
Expand Down
2 changes: 1 addition & 1 deletion src/vptstools/vpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def vp(file_path, vpts_csv_version="v1.0", source_file=""):
>>> file_path = Path("bejab_vp_20221111T233000Z_0x9.h5")
>>> vp(file_path)
>>> vp(file_path,
... source_file="s3://aloft/baltrad/hdf5/2022/11/11/bejab_vp_20221111T233000Z_0x9.h5") #noqa
... source_file="s3://aloftdata/baltrad/hdf5/2022/11/11/bejab_vp_20221111T233000Z_0x9.h5") #noqa
Use file name itself as source_file representation in vp file using a custom
callable function
Expand Down
4 changes: 2 additions & 2 deletions src/vptstools/vpts_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ def check_source_file(source_file, regex):
Examples
--------
>>> check_source_file("s3://alof/baltrad/2023/01/01/"
>>> check_source_file("s3://aloftdata/baltrad/2023/01/01/"
... "bejab_vp_20230101T000500Z_0x9.h5",
... r".*h5")
's3://alof/baltrad/2023/01/01/bejab_vp_20230101T000500Z_0x9.h5'
's3://aloftdata/baltrad/2023/01/01/bejab_vp_20230101T000500Z_0x9.h5'
"""
sf_regex = re.compile(regex)
if re.match(sf_regex, source_file):
Expand Down
10 changes: 5 additions & 5 deletions tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ def test_parse_file_from_inventory(self, file_path, components):
odim_path.s3_path_setup(file_type)
== f"{source}/{file_type}/{radar_code}/{year}"
)
bucket = "aloft"
bucket = "aloftdata"
assert (
odim_path.s3_url_h5(bucket)
== f"s3://{bucket}/{source}/{file_type}/{radar_code}/"
Expand Down Expand Up @@ -535,25 +535,25 @@ def test_handle_inventory_alternative_suffix(self):
df_inventory = pd.DataFrame(
[
{
"repo": "aloft",
"repo": "aloftdata",
"file": "baltrad/coverage.csv",
"size": 1,
"modified": pd.Timestamp("2023-01-31 00:00:00+0000", tz="UTC"),
},
{
"repo": "aloft",
"repo": "aloftdata",
"file": "baltrad/inventory.csv.gz",
"size": 1,
"modified": pd.Timestamp("2023-01-31 00:00:00+0000", tz="UTC"),
},
{
"repo": "aloft",
"repo": "aloftdata",
"file": "baltrad/manifest.json",
"size": 1,
"modified": pd.Timestamp("2023-01-31 00:00:00+0000", tz="UTC"),
},
{
"repo": "aloft",
"repo": "aloftdata",
"file": "baltrad/14azd6.checksum",
"size": 1,
"modified": pd.Timestamp("2023-01-31 00:00:00+0000", tz="UTC"),
Expand Down
6 changes: 3 additions & 3 deletions tests/test_vph5_to_vpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ def test_e2e_cli(s3_inventory, path_inventory, tmp_path):

# Compare resulting coverage file with reference coverage ---------------------
with open(tmp_path / "coverage.csv", "wb") as f:
s3_inventory.download_fileobj("aloft", "coverage.csv", f)
s3_inventory.download_fileobj("aloftdata", "coverage.csv", f)
filecmp.cmp(path_inventory / "coverage.csv", tmp_path / "coverage.csv")

# Compare resulting daily file
with open(tmp_path / "nosta_vpts_20230311.csv", "wb") as f:
s3_inventory.download_fileobj(
"aloft", "baltrad/daily/nosta/2023/nosta_vpts_20230311.csv", f
"aloftdata", "baltrad/daily/nosta/2023/nosta_vpts_20230311.csv", f
)
filecmp.cmp(
path_inventory / "nosta_vpts_20230311.csv",
Expand All @@ -55,7 +55,7 @@ def test_e2e_cli(s3_inventory, path_inventory, tmp_path):
# Compare resulting monthly file
with open(tmp_path / "nosta_vpts_202303.csv.gz", "wb") as f:
s3_inventory.download_fileobj(
"aloft", "baltrad/monthly/nosta/2023/nosta_vpts_202303.csv.gz", f
"aloftdata", "baltrad/monthly/nosta/2023/nosta_vpts_202303.csv.gz", f
)
filecmp.cmp(
path_inventory / "nosta_vpts_202303.csv.gz",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_vpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def test_vp_custom_callable_file(self, vpts_version, path_with_vp):

# Use a conversion to S3 function
df_vp = vp(file_path, vpts_version, _convert_to_source_s3)
assert df_vp["source_file"].str.startswith("s3://aloft/baltrad").all()
assert df_vp["source_file"].str.startswith("s3://aloftdata/baltrad").all()

def test_vpts_no_source_file(self, vpts_version, path_with_vp):
"""The file name itself is used when no source_file reference is provided"""
Expand Down Expand Up @@ -233,7 +233,7 @@ def test_vpts_custom_callable_file(self, vpts_version, path_with_vp):

# Use a conversion to S3 function
df_vpts = vpts(file_paths, vpts_version, _convert_to_source_s3)
assert df_vpts["source_file"].str.startswith("s3://aloft/baltrad").all()
assert df_vpts["source_file"].str.startswith("s3://aloftdata/baltrad").all()

def test_vp_invalid_file(self, vpts_version, path_with_wrong_h5): # noqa
"""Invalid h5 vp file raises InvalidSourceODIM exceptin"""
Expand Down

0 comments on commit 14cd79f

Please sign in to comment.