NREL / hsds-examples

Examples of using the HSDS Service to Access NREL WIND Toolkit data
https://www.nrel.gov/grid/wind-toolkit.html
Other
94 stars 40 forks source link

hsconfigure error #14

Closed jabouche closed 2 years ago

jabouche commented 2 years ago

The command hsconfigure does not work for me - I get a Name Error. NameError: name 'hsconfigure' is not defined

I tried to create a .hscfg file with the necessary information (including my own API code), but that has not worked either. I wrote code that created a .hscfg file with the 4 required pieces on information, but the code I'm running that uses h5pyd does not seem to find the information.

I've been trying to pull data from WIND for a wind rose calculation in a FLORIS example. File "C:\Users\jessb\anaconda3\lib\site-packages\h5pyd\_hl\httpconn.py", line 195, in __init__ raise ValueError(msg)

ValueError: no endpoint set

Thanks

jreadey commented 2 years ago

That seems strange... did you build h5pyd yourself and did you do a pip install? What version of python are you running?

What do you get when you run hsinfo?

jabouche commented 2 years ago

I did pip install h5pyd, and I'm running Python 3.9.7. I get the same NameValue error with hsinfo.

Full error: "File "C:\Users\jessb\AppData\Local\Temp/ipykernel_16624/4172585631.py", line 1, in hsinfo

NameError: name 'hsinfo' is not defined"

jreadey commented 2 years ago

Hmmm.. And if you run: pip freeze | grep h5pyd?

jreadey commented 2 years ago

BTW, I tried this out on a Windows 10 box just now and it worked ok. Here's what I did:

  1. Installed Anaconda Individual for 64bit: https://repo.anaconda.com/archive/Anaconda3-2021.11-Windows-x86_64.exe
  2. Did pip install h5pyd
  3. Ran hsconfigure using https://developer.nrel.gov/api/hsds as the endpoint, and my nrel api key (left username and password as None)
  4. Ran hsinfo and got connection to the NREL hsds server
jabouche commented 2 years ago

Running pip freeze | grep h5pyd gives me this:

Note: you may need to restart the kernel to use updated packages. 'grep' is not recognized as an internal or external command, operable program or batch file.

(I pip installed grep, restarted Sypder and got the same error)

Also, neither the hsconfigure or hsinfo command worked. I get the same NameError.

I dug into the files for h5pyd and found a test file (location: ...\anaconda3\pkgs\h5py-3.2.1-py39h3de5c98_0\info\test\run_test.py). I got on error after running it:

Traceback (most recent call last): File "C:\Users\jessb\anaconda3\pkgs\h5py-3.2.1-py39h3de5c98_0\info\test\run_test.py", line 39, in exit(h5py.run_tests()) SystemExit: 1

This is some of the code. the "have_mpi" variable comes out as false


33 # verify that mpi builds are built with mpi
34 should_have_mpi = os.getenv('mpi', 'nompi') != 'nompi'
35 have_mpi = h5py.get_config().mpi
36 assert have_mpi == should_have_mpi, "Expected mpi=%r, got %r" % (should_have_mpi, have_mpi)

38 from sys import exit 39 exit(h5py.run_tests())


Does this mean anything? Are there other tests I can do?
jreadey commented 2 years ago

h5py is a different package than h5pyd -- h5py is the python package for working with HDF5 files while h5pyd is a client for the HSDS server. They do share (mostly) the same API.

I'm wondering if there is something off with your Python environment. Since it looks like you do have h5py installed, can you run the examples in the h5py getting started guide: https://docs.h5py.org/en/stable/quick.html?

jabouche commented 2 years ago

I figured it out - I opened the hsconfigure script, ran it, and it connected! Thanks for your help! (From the h5pyd set-up instructions, it wasn't clear it was its own script)

jreadey commented 2 years ago

Awesome. I do most of my testing on a Mac or Linux, so glad to hear everything is working on Windows.