html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue
https://github.com/pydata/xarray/issues/3466#issuecomment-1013673140,https://api.github.com/repos/pydata/xarray/issues/3466,1013673140,IC_kwDOAMm_X848a2y0,6815953,2022-01-15T12:21:44Z,2022-01-17T10:37:59Z,NONE,"Hi all,
I encountered the same problem when trying to download NASA's GEOS-5 data (see below). It worked occasionally but I had to restart the script several times.
```python
import xarray as xr
import pandas as pd
URL ='https://opendap.nccs.nasa.gov/dods/GEOS-5/fp/0.25_deg/assim/inst3_3d_asm_Np'
ds = xr.open_dataset(URL,engine='netcdf4')
var_ls = ['omega', 't', 'v', 'u']
lev_ls = [1000., 975., 950., 925., 900., 875., 850., 825., 800.,
775., 750., 700., 650., 600., 550., 500., 450., 400.,
350., 300., 275., 250., 225., 200., 175., 150., 125.,
100., 70., 50., 30., 10., 5.,3, 2, 1]
time_range = pd.date_range('2021-01-02T12', '2021-01-07', freq = '6H')
for sel_date in time_range:
ds_sel = ds[var_ls].sel(
time = sel_date,
lev = lev_ls,
method = 'nearest'
)
ouf_date=sel_date.strftime('%Y%m%d%H')
outfile = f'geos5_subset_{ouf_date}.nc'
print(outfile)
ds_sel.to_netcdf(outfile)
```
[EDIT] It may have helped to add `.load` before `to_netcdf` though.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,514672231