blaylockbk / Herbie

Download numerical weather prediction datasets (HRRR, RAP, GFS, IFS, etc.) from NOMADS, NODD partners (Amazon, Google, Microsoft), ECMWF open data, and the University of Utah Pando Archive System.
https://herbie.readthedocs.io/
MIT License
495 stars 74 forks source link

PRMSL for GEFS found in Herbie.inventory, but not able to grab with Herbie.xarray #256

Closed bryanguarente closed 10 months ago

bryanguarente commented 10 months ago

Brian,

I have been running your code for quite a while now and as recently as last year, I have been able to grab the MLSP (PRMSL) from GEFS data and plot it, but as of yesterday (my first finding of it) I am not able to grab the xarray of the PRMSL from GEFS members.

Here is what I am trying:

model="gefs"
typ='atmos.5'
init = '2023-09-06T1200'
H = Herbie(init, fxx=6, model=model, product=typ, member='p01')
H.inventory('PRMSL') # --> this line works!
nwp = H.xarray('PRMSL') #--> this line fails, with the following error...
TypeError                                 Traceback (most recent call last)
[<ipython-input-12-b05b31f46b6b>](https://localhost:8080/#) in <cell line: 1>()
----> 1 nwp = H.xarray('PRMSL')

2 frames
[/usr/local/lib/python3.10/dist-packages/herbie/core.py](https://localhost:8080/#) in subset(searchString, outFile)
    911                 # cURL ranges are end-inclusive, so subtract one from our end-exclusive end_byte
    912                 curl_ranges.append(
--> 913                     f"{_df.iloc[0].start_byte}-{_df.iloc[-1].end_byte-1}"
    914                 )
    915                 group_dfs.append(_df)

TypeError: unsupported operand type(s) for -: 'str' and 'int'

Any ideas why that is suddenly failing?

Thanks, Bryan

cmo84 commented 10 months ago

Looks related to this change

https://github.com/blaylockbk/Herbie/commit/097600675dad6eecc799e9e404bba6123cb06a52

blaylockbk commented 10 months ago

Thanks for catching this. Yes, it looks like it's related to https://github.com/blaylockbk/Herbie/commit/097600675dad6eecc799e9e404bba6123cb06a52

blaylockbk commented 10 months ago

Oh, I see...there is no end byte; and of course you can't subtract from a string. image

I'll try to reimplement this.

blaylockbk commented 10 months ago

Hey @bryanguarente, thanks for being so quick finding this bug. I just merged a fix and released 2023.12.3. This inspires me to work on the Herbie test more.

I'll try to do the the conda-forge release in the next day or two.

bryanguarente commented 10 months ago

I just ran my Google Colab script with this after reimporting Herbie with pip and it worked straight away with the 2023.12.3 install. Thanks for the quick fix. I appreciate it.