NREL / rex

REsource eXtraction Tool (rex)
https://nrel.github.io/rex
BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

`ds_name` not defined in docs #149

Closed ssolson closed 1 year ago

ssolson commented 1 year ago

Hey Rex team I am having issues using the API docs because I cannot find the definition of ds_name here: https://nrel.github.io/rex/_autosummary/rex.resource_extraction.resource_extraction.MultiYearWaveX.html#rex.resource_extraction.resource_extraction.MultiYearWaveX image

Can you point me to the defintinition of ds_name the docs to help me use one of these methods? E.g. I am not sure what I need to put here and ds_name (str) – Dataset to extract is unclear to me what I need to put here

grantbuster commented 1 year ago

Well so... what data are you interested in extracting? h5 files have datasets and each dataset has a name. You need to use that name to extract the data from that dataset. For example, if i was looking at NSRDB files and i wanted global horizontal irradiance (GHI), the dataset name in the h5 file is "ghi"

ssolson commented 1 year ago

Hey, Grant if I am making the following request:

from rex import MultiYearWaveX, WaveX

data_type = '3-hour' 
years = [1995]
lat_lon = (43.489171,-125.152137) 
region ='West_Coast'
parameter = 'significant_wave_height'

wave_path = f'/nrel/US_wave/{region}/{region}_wave_*.h5'

wave_kwargs = {
    'tree':None,
    'unscale':True,
    'str_decode':True,
    'hsds':True,
    'years':years
}

with MultiYearWaveX(wave_path, **wave_kwargs) as rex_waves:
    gid = rex_waves.lat_lon_gid(lat_lon)
    rex_waves.get_gid_df(ds_name, gid)

How do I know what ds_name is and where do I find a list of potentialds_names?

grantbuster commented 1 year ago

i think your "parameter" variable is the dataset name you're looking for. The dsets attribute of the WaveX object will print the datasets available.