[我正在尝试做的事情:我一直在尝试从OPeNDAP(当前和风力气象数据)中缓存一个.nc文件。 http://thredds.met.no/thredds/dodsC/sea/nordic4km/zdepths1h/aggregate_be.html以便它给我的文件版本与使用http://thredds.met.no/thredds/dodsC/sea/nordic4km/zdepths1h/aggregate_be]用NETCDF4库数据集(OpenDrift Library)查询
their reader file中来自OpenDrift库的原始代码如下:
if ('*' in filestr) or ('?' in filestr) or ('[' in filestr): self.logger.info('Opening files with MFDataset') if has_xarray: self.Dataset = xr.open_mfdataset(filename) else: self.Dataset = MFDataset(filename) else: self.logger.info('Opening file with Dataset') if has_xarray: self.Dataset = xr.open_dataset(filename) else: self.Dataset = Dataset(filename, 'r')
文件名是url,例如“ http://thredds.met.no/thredds/dodsC/sea/nordic4km/zdepths1h/aggregate_be”
到目前为止尝试过的方法:
1。过滤数据以下载数据集的子集
nccopy http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be?Cs_r[0:1:34],Cs_w[0:1:35],X[0:1:2601],Y[0:1:901],angle[0:1:0][0:1:0],depth[0:1:15],forecast_reference_time,h[0:1:0][0:1:0],hc,lat[0:1:0][0:1:0],lon[0:1:0][0:1:0],projection_stere,AKs[0:1:0][0:1:0][0:1:0][0:1:0],Uwind[0:1:0][0:1:0][0:1:0],Vwind[0:1:0][0:1:0][0:1:0],salinity[0:1:0][0:1:0][0:1:0][0:1:0],temperature[0:1:0][0:1:0][0:1:0][0:1:0],time[0:1:21690],tke[0:1:0][0:1:0][0:1:0][0:1:0],u[0:1:0][0:1:0][0:1:0][0:1:0],u_eastward[0:1:0][0:1:0][0:1:0][0:1:0],ubar[0:1:0][0:1:0][0:1:0],v[0:1:0][0:1:0][0:1:0][0:1:0],v_northward[0:1:0][0:1:0][0:1:0][0:1:0],vbar[0:1:0][0:1:0][0:1:0],w[0:1:0][0:1:0][0:1:0][0:1:0],zeta[0:1:0][0:1:0][0:1:0] norkyst.nc
这给了我一个丢失了很多数据的小文件(可以作为读取器读取,但是使用ncdump显示ubar等数据丢失了)2。尝试下载整个数据集
nccopy -4 http://thredds.met.no/thredds/dodsC/sea/norkyst800m/1h/aggregate_be norkystFull.nc
导致33GB的文件退出下载。 (给出HDF错误)[我正在尝试做的事情:我一直在尝试从OPeNDAP(当前和风力气象数据)中缓存.nc文件。http://thredds.met.no/thredds/dodsC/sea/nordic4km/zdepths1h/ gregate_be.html,以便它...
THREDDS中的OPeNDAP具有最大数量的数据,可让您通过一次访问下载,这可能会阻止您使用一个命令下载整个聚合。您可以通过下载子集然后在本地对其进行串联来解决此问题。例如,如果您安装了NCO utilities,则可以使用ncks
和时域子设置选项,将子集下载到本地netCDF文件,然后使用ncrcat
进行串联。