-
Notifications
You must be signed in to change notification settings - Fork 16
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
607 review request to integrate universal pipeline #611
Merged
tomkralidis
merged 18 commits into
main
from
607-review-request-to-integrate-universal-pipeline
Jan 22, 2024
Merged
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b9c298c
grib2-pipeline-plugin-demo-from-CMA
alimand a2d93e0
Update data-mappings.yml
alimand 69397bb
add china-NWP-grib2 testing data
alimand 347d5d1
update universal pipeline and center-id,add discovery-metadata
alimand 79b6508
Update GRAPES-GEPS-GLB.yml
alimand 6aaa2aa
add test and documentation
maaikelimper ce866e6
uncommit local port
maaikelimper 114ad30
flake8, remove md, fix expected numbers
maaikelimper 8b57eaa
align numbers
maaikelimper 518b104
5 + 11 = 16 (to validate congo msg 5, skip 11 china msg)
maaikelimper 0d26b01
Update tests-docker.yml
tomkralidis 551f103
Update data-pipeline-plugins.rst
tomkralidis 5a295b7
Update GRAPES-GEPS-GLB.yml
tomkralidis d2aba7c
update metadata, topic, identifier, filename
tomkralidis be13a0b
update metadata, topic, identifier, filename
tomkralidis 68ba4c5
Update cn-grapes-geps-global.yml
tomkralidis 0310f1b
Update tests-docker.yml
tomkralidis 126b80b
Update data-mappings.yml
tomkralidis 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
Binary file added
BIN
+2.46 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-024.grib2
Binary file not shown.
Binary file added
BIN
+3.21 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-036.grib2
Binary file not shown.
Binary file added
BIN
+3.52 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-048.grib2
Binary file not shown.
Binary file added
BIN
+3.7 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-060.grib2
Binary file not shown.
Binary file added
BIN
+3.86 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-072.grib2
Binary file not shown.
Binary file added
BIN
+3.96 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-084.grib2
Binary file not shown.
Binary file added
BIN
+3.95 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-096.grib2
Binary file not shown.
Binary file added
BIN
+4.01 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-108.grib2
Binary file not shown.
Binary file added
BIN
+4.12 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-120.grib2
Binary file not shown.
Binary file added
BIN
+4.15 MB
tests/data/observations/china/Z_NAFP_C_BABJ_20231207000000_P_CMA-GEPS-GLB-132.grib2
Binary file not shown.
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,55 @@ | ||
from datetime import datetime | ||
import logging | ||
from pathlib import Path | ||
import re | ||
from typing import Union | ||
|
||
from dateutil.parser import parse | ||
|
||
from wis2box.data.base import BaseAbstractData | ||
|
||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class UniversalData(BaseAbstractData): | ||
"""Universal data""" | ||
|
||
def __init__(self, defs: dict) -> None: | ||
super().__init__(defs) | ||
|
||
def transform(self, input_data: Union[Path, bytes], | ||
filename: str = '') -> bool: | ||
|
||
filename2 = Path(filename) | ||
LOGGER.debug('Procesing data') | ||
input_bytes = self.as_bytes(input_data) | ||
|
||
LOGGER.debug('Deriving datetime') | ||
|
||
match = re.search(self.file_filter, filename2.name) | ||
if match: | ||
date_time = match.group(1) | ||
else: | ||
LOGGER.debug('Could not derive date/time: using today\'s date') | ||
date_time = datetime.now() | ||
|
||
if date_time: | ||
date_time = parse(date_time) | ||
|
||
rmk = filename2.stem | ||
suffix = filename2.suffix.replace('.', '') | ||
|
||
self.output_data[rmk] = { | ||
suffix: input_bytes, | ||
'_meta': { | ||
'identifier': rmk, | ||
'relative_filepath': self.get_local_filepath(date_time), | ||
'data_date': date_time | ||
} | ||
} | ||
|
||
return True | ||
|
||
def get_local_filepath(self, date_): | ||
yyyymmdd = date_.strftime('%Y-%m-%d') | ||
return Path(yyyymmdd) / 'wis' / self.topic_hierarchy.dirpath |
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.
Add source code header (see example)