Specifying filename for download #58
jim-steenburgh
started this conversation in
General
Replies: 1 comment
-
That is a very good question. I originally designed Herbie to mimic the directory structure on the remote. But it does look like you can change the filename with a little hack. When you create a Herbie object, there is an attribute from herbie.archive import Herbie
H = Herbie('2021-01-01', model='hrrr', product='sfc', fxx=6)
H.LOCALFILE = 'custom_name' # <-- Name the file whatever you want
H.download()
You can use the Herbie attributes to be more specific with the custom filename: H.LOCALFILE = f"model_{H.model.upper()}_{H.date:%Y%m%d%H}_F{H.fxx:02d}_valid_{H.valid_date:%Y%m%d%H}.grib2"
H.download()
# Downloads file: model_HRRR_2021010100_F06_valid_2021010106.grib2
H.LOCALFILE = f"model_{H.model.upper()}_surfaceFields_{H.date:%Y%m%d%H}_F{H.fxx:02d}.grib2"
H.download()
# Downloads file: model_HRRR_surfaceFields_2021010100_F06.grib2 Caveats:
I created a new issue #60 and I'll see if I can implement a more intuitive way to do this. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to specify the filename to write to when doing H.download?
Beta Was this translation helpful? Give feedback.
All reactions