Closed gjoseph92 closed 6 months ago
Thanks for the report. That dataset predates our SAS API, hence the pre-generated SAS token (which has perhaps expired).
I added that storage container to our SAS endpoint, so https://planetarycomputer.microsoft.com/api/sas/v1/token/nrel/nrel-nsrdb should work now (there might be some caching, so in ~5-10 minutes).
Just an FYI, since you mentioned the Hub, that dataset is in the East US region (the hub is in West Europe).
I think that xr.open_dataset(fsspec.open(url).open())
should work for reading the data over the network without h5pyd.
Thanks @TomAugspurger. With the SAS fix, this seems to work on the Hub:
import xarray as xr
import pandas as pd
import planetary_computer as pc
from adlfs import AzureBlobFileSystem
# Storage resources
storage_account = 'nrel'
container = 'nrel-nsrdb'
token = pc.sas.get_token(storage_account, container)
fs = AzureBlobFileSystem(storage_account, sas_token=token.token)
annual_files = fs.glob(container + '/v3/*.h5')
print('Found {} annual files:'.format(len(annual_files)))
for k in range(0,10):
print(annual_files[k])
print('...')
f = fs.open(annual_files[-1])
ds = xr.open_dataset(f, chunks="auto", phony_dims='sort')
ds.air_temperature[0, 0].compute()
Might be worth updating the notebook to mention this. (Also looks this only goes up to 2020, so maybe this isn't actively maintained in the first place.)
I'll get the notebook updated, and I'm checking on the status of newer data.
https://github.com/microsoft/AIforEarthDataSets/pull/38 updated the notebook. I think nbviewer caches stuff for a while, but it'll eventually be updated there as well.
When trying to run the National Solar Radiation Database example notebook on the PC hub, I get a couple errors:
Fine, let's see if we can just list the blobs at least.
So some form of auth (which isn't automatically set up for me on the Hub) is required to access the bucket?
FWIW, trying this on a whim didn't work:
Also, following the link in the "Mounting the Container" section (which seems to include a pre-generated SAS token?) gives