Skip to content

Commit

Permalink
bug: aws.ls(): always include trailing slash (#93)
Browse files Browse the repository at this point in the history
* append / to s3 ls path if not provided

* add more DAS fields to field.json jsonschema
  • Loading branch information
mackenzie-grimes-noaa authored Jan 13, 2025
1 parent 41e14b0 commit cbb5d18
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 7 deletions.
8 changes: 6 additions & 2 deletions python/idsse_common/idsse/common/aws_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,16 @@ def ls(self, path: str, prepend_path: bool = True) -> Sequence[str]:
"""Execute a 'ls' on the AWS s3 bucket specified by path
Args:
path (str): s3 bucket
prepend_path (bool): Add to the filename
path (str): path to S3 bucket directory, e.g. s3://my-bucket/
prepend_path (bool): Add the full s3 bucket path to any returned filenames.
Defaults to True.
Returns:
Sequence[str]: The results sent to stdout from executing a 'ls' on passed path
"""
if path[-1] != '/':
path = path + '/' # ensure a trailing slash, which is expected by S3

try:
commands = ['s5cmd', '--no-sign-request', 'ls', path]
commands_result = exec_cmd(commands)
Expand Down
29 changes: 24 additions & 5 deletions python/idsse_common/idsse/common/schema/field.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,33 @@
"description": "Identifier for a known field",
"type": "string",
"enum": [
"TEMP",
"WINDSPEED",
"WINDGUST",
"APPTEMP",
"CEILING",
"DEWPOINT",
"RH",
"ECHOTOP",
"ICE1HR",
"ICE:1HR",
"ICE:6HR",
"ICE:24HR",
"MAXREF",
"PROBTHDR:1HR",
"PROBTHDR:3HR",
"PROBTHDR:6HR",
"PROBTHDR:12HR",
"RAIN1HR",
"RAIN:1HR",
"RAIN:6HR",
"RH",
"SNOW1HR",
"ICE1HR"
"SNOW:1HR",
"SNOW:6HR",
"SNOW:24HR",
"TEMP",
"VIL",
"VISIBILITY",
"WINDDIR",
"WINDGUST",
"WINDSPEED"
]
},

Expand Down

0 comments on commit cbb5d18

Please sign in to comment.