Skip to content

Can't load xarray from certain URL #8626

Answered by andersy005
chudlerk asked this question in Q&A
Discussion options

You must be logged in to vote

@chudlerk, for this to work, you can use fsspec as follows:

In [10]: import xarray as xr

In [11]: import fsspec

In [12]: url ='https://www.nodc.noaa.gov/archive/arc0196/0245564/1.1/data/0-data/prcp-1991_2020-monthly-normals-v1.0.nc'

In [13]: ds = xr.open_dataset(fsspec.open(url).open(), chunks={})

In [12]: ds
Out[12]: 
<xarray.Dataset>
Dimensions:        (lon: 1385, lat: 596, time: 12, seasons: 4)
Coordinates:
  * lon            (lon) float32 -124.7 -124.6 -124.6 ... -67.1 -67.06 -67.02
  * lat            (lat) float32 49.35 49.31 49.27 49.23 ... 24.65 24.6 24.56
  * time           (time) int32 1 2 3 4 5 6 7 8 9 10 11 12
  * seasons        (seasons) int32 1 2 3 4
Data variables: (12/15)…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@chudlerk
Comment options

@andersy005
Comment options

Answer selected by chudlerk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #8620 on January 19, 2024 07:03.