0

So I need to be working switch my code from jupyter notebook to spyder. I did some research on this error but all I have seen is doing it in jupyter solves the problem. This code came from jupyter and I need to run it on my local pc but now its not working. Does anyone know the workaround for this?

########## HAIL
url = 'https://nomads.ncep.noaa.gov/cgi-bin/filter_hrrr_2d.pl?file=hrrr.t{run}z.wrfsfcf{fhr}.grib2&lev_0.1_sigma_level=on&var_HAIL=on&leftlon=0&rightlon=360&toplat=90&bottomlat=-90&dir=%2Fhrrr.{ymd}%2Fconus'
URL = url.format(run=run, fhr=fhr, ymd=ymd)
r = requests.get(URL)
with open(r"C:\Users\kevin\Documents\extradata\hrr.hail.03", 'wb') as fh:
          fh.write(r.content)

ds3 = xr.open_dataset(r"C:\Users\kevin\Documents\extradata\hrr.hail.03", engine='cfgrib')
lon, lat = ds3.longitude.values-360., ds3.latitude.values
hail = ds3.variables['hail']
hrrr3 = ds3.to_dataframe(dim_order=None)
JFK3 = hrrr3.iloc[[1251865, 1098863, 192179, 1093479, 364831, 580191, 1204696, 1395843, 1167136, 674130, 497931, 983360, 396676, 1585171, 826965, 687506, 319820, 1116874, 1179873, 1162649, 1262386, 1395238, 1072383, 405745, 1703931, 680474, 881884, 812749, 1056709, 782826, 1219370, 1064428, 745683, 1008418, 877572, 1222854]]
print("done")

The error I get is

ValueError: unrecognized engine cfgrib must be one of: ['scipy', 'store']

I downloaded spyder via anaconda/anaconda navigator and when i try to install cgfrib package it says it does not exists..

A solution would also be I just run everythin in a jupyter notebook but the code would HAVE to be able to save the image generated to my pc documents.

  • this doesn't have anything to do with jupyter, but with the environment setup. please always provide the [full traceback](//realpython.com/python-traceback) whenever asking about errors - they contain vital debugging details. this is definitely an issue with your conda environment. are you sure you have your [conda environment activated in syder](https://stackoverflow.com/questions/30170468/how-to-run-spyder-in-virtual-environment), and that that environment has cfgrib installed? – Michael Delgado Feb 19 '22 at 01:27
  • Specifically, look for the [newer answers](https://stackoverflow.com/a/60161513/3888719) in that post, which reference the [official spyder docs](https://docs.spyder-ide.org/current/faq.html#using-existing-environment) on how to work *with* conda envs rather than installing spyder into each one. – Michael Delgado Feb 19 '22 at 19:08
  • Does this answer your question? [How to run Spyder in virtual environment?](https://stackoverflow.com/questions/30170468/how-to-run-spyder-in-virtual-environment) – Michael Delgado Feb 19 '22 at 19:08

0 Answers0