-
I've got an s3-compatible Open Storage Network bucket that has anonymous read access. With fsspec, I would do: import fsspec
fs_read = fsspec.filesystem('s3', anon=True, endpoint_url='https://usgs.osn.mghpcc.org')
fs_read.ls('esip/rsignell/testing') and for writing, I specify AWS keys as environment vars and then do: fs_write = fsspec.filesystem('s3', anon=False, endpoint_url='https://usgs.osn.mghpcc.org')
fs_write.upload('myfile.nc', 's3://esip/rsignell/testing/') How can I instantiate S3Store objects for these two use cases? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I think you should be able to do something like store = S3Store(skip_signature=True, endpoint="https://usgs.osn.mghpcc.org") I think you may need store = S3Store(skip_signature=True, endpoint="https://usgs.osn.mghpcc.org", virtual_hosted_style_request=True) |
Beta Was this translation helpful? Give feedback.
-
I'm still getting "forbidden". This should be reproducible: from obstore.store import S3Store
from virtualizarr import open_virtual_dataset
from virtualizarr.parsers import NetCDF3Parser
from virtualizarr.registry import ObjectStoreRegistry
bucket = "s3://esip"
store = S3Store(bucket, skip_signature=True, endpoint="https://usgs.osn.mghpcc.org", virtual_hosted_style_request=True)
registry = ObjectStoreRegistry({bucket: store})
parser = NetCDF3Parser()
path = "rsignell/testing/shyfem/nos00.nc"
url = f"{bucket}/{path}"
vds = open_virtual_dataset(url, registry=registry, parser=parser,
loadable_variables=[]) I guess this could be a virtualizarr issue? But this returns nothing also:
User error? |
Beta Was this translation helpful? Give feedback.
-
Okay, @maxrjones figured this out! endpoint = "https://usgs.osn.mghpcc.org"
path = "esip/rsignell/testing/shyfem"
file = "nos00.nc"
scheme = "s3://"
# Create the S3Store
store = S3Store.from_url(f"{scheme}{path}", endpoint=endpoint, skip_signature=True, region='us-east-1')
for obs in obstore.list(store):
print(obs) produces:
|
Beta Was this translation helpful? Give feedback.
Okay, @maxrjones figured this out!
produces: