-
Notifications
You must be signed in to change notification settings - Fork 9
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
Store snow masked hfi rasters #3807
Closed
Closed
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import os | ||
from app.auto_spatial_advisory.run_type import RunType | ||
from datetime import date | ||
|
||
|
||
def get_pmtiles_filepath(run_date: date, run_type: RunType, filename: str) -> str: | ||
""" | ||
Get the file path for both reading and writing the pmtiles from/to the object store. | ||
Example: {bucket}/psu/pmtiles/hfi/actual/[issue/run_date]/hfi[for_date].pmtiles | ||
|
||
|
||
:param run_date: The date of the run to process. (when was the hfi file created?) | ||
:param run_type: forecast or actual | ||
:param filename: hfi[for_date].pmtiles -> hfi20230821.pmtiles | ||
:return: s3 bucket key for pmtiles file | ||
""" | ||
pmtiles_filepath = os.path.join("psu", "pmtiles", "hfi", run_type.value, run_date.strftime("%Y-%m-%d"), filename) | ||
|
||
return pmtiles_filepath | ||
|
||
|
||
def get_pmtiles_filename(for_date: date): | ||
return f'hfi{for_date.strftime("%Y%m%d")}.pmtiles' | ||
|
||
|
||
def get_raster_filepath(run_date: date, run_type: RunType, filename: str) -> str: | ||
""" | ||
Get the file path for both reading and writing the tif raster from/to the object store. | ||
Example: {bucket}/psu/rasters/hfi/actual/[issue/run_date]/hfi[for_date].tif | ||
|
||
|
||
:param run_date: The date of the run to process. (when was the hfi file created?) | ||
:param run_type: forecast or actual | ||
:param filename: hfi[for_date].tif -> hfi20230821.tif | ||
:return: s3 bucket key for raster file | ||
""" | ||
raster_filepath = os.path.join("psu", "rasters", "hfi", run_type.value, run_date.strftime("%Y-%m-%d"), filename) | ||
|
||
return raster_filepath | ||
|
||
|
||
def get_raster_tif_filename(for_date: date) -> str: | ||
""" | ||
Returns the object store filename for a raster tif based on a given for_date. | ||
|
||
:param for_date: the date the hfi tif is forecasted for | ||
:return: filename string | ||
""" | ||
return f'snow_masked_hfi{for_date.strftime("%Y%m%d")}.tif' |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use the
get_pmtiles_filename()
function fromhfi_filepath.py
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops thanks, done in 878183e