Skip to content
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

[draft] pooch transfer test #12

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pattern
  • Loading branch information
norlandrhagen committed Aug 15, 2024
commit 7bd529d15d650d6b585eadcb847fcb68114ec447
2 changes: 1 addition & 1 deletion feedstock/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: >
recipes:
- id: eNATL60_BLBT02
object: "eNATL60:eNATL60_BLBT02"
- id: pooch-recipe
- id: poochrecipe
object: "poochtransfer:poochpipeline"
provenance:
providers:
Expand Down
8 changes: 6 additions & 2 deletions feedstock/poochtransfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import pooch
import subprocess
import os
from pangeo_forge_recipes.patterns import pattern_from_file_sequence

# grab from recipes
import logging
Expand Down Expand Up @@ -43,10 +44,14 @@ def make_full_path(time):


flist = [make_full_path(time) for time in dates]
flist = flist[0:2]
pattern = pattern_from_file_sequence(flist, concat_dim="time")


class DownloadAndTransfer(beam.DoFn):
def process(self, url, bucket):
# unpack filepattern tuple
url = url[1]
# grab last bit of filename
filename = url.split("/")[-1]

Expand All @@ -69,10 +74,9 @@ def process(self, url, bucket):
os.remove(local_path)


flist = flist[0:2]
# Define and run the pipeline
bucket = "leap-scratch/norlandrhagen/pooch"

poochpipeline = beam.Create(flist) | "pooch and s5cmd" >> beam.ParDo(
poochpipeline = beam.Create(pattern.items()) | "pooch and s5cmd" >> beam.ParDo(
DownloadAndTransfer(), bucket=bucket
)