id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 1039113959,I_kwDOAMm_X849757n,5913,Invalid characters in OpenDAP URL,57886986,closed,0,,,5,2021-10-29T02:54:14Z,2024-04-28T20:55:17Z,2024-04-28T20:55:17Z,NONE,,,,"Hello, I have successfully opened an OpenDAP URL with ds = xarray.open_dataset(url) However, after selecting a subset with ds = ds.isel(time=0) and attempting to load the data with ds.load(), I get the following error: HTTP Status 400 – Bad Request: Invalid character found in the request > target. The valid characters are defined in RFC 7230 and RFC 3986 I suspect the reason is that square brackets are passed in the URL when attempting to load: ...zg_6hrPlevPt_MIROC6_historical_r1i1p1f1_gn_185001010600-185101010000.nc.dods?zg.zg[0][0:6][0:127][0:255]] because of the index selection with .isel() In fact, some servers do forbid square brackets: https://www.unidata.ucar.edu/mailing_lists/archives/thredds/2020/msg00056.html Would it be possible to provide an option to encode URLs? ( [ becomes %5B, and ] becomes %5D ) Or, instead of loading directly with ds.load(), is there a way for me to retrieve the URL with offending brackets that is generated automatically by xarray, encode it myself, and then use ds2 = xarray.load_dataset(encoded_url) to load? Thank you for your help!","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5913/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,not_planned,13221727,issue