我是Unix上的新手,正在使用NetCDF文件。我正在尝试从NetCDF中提取速度数据,以便在一个精确的位置上对电流的速度进行计时。
我正在SSH服务器上使用R。
我的NetCDF有7个变量和5个维度。我想提取称为vozocrtx的速度,它具有4个维度[x,y,depthu,time_counter]。
我认为x,y和depthu是浮点型,而time_counter是double。
当我只想使用nc = nc_open(文件名)打开文件时,出现此错误:
Rsx_nc4_get_vara_double中的错误:NetCDF:HDF错误 变量:time_counter Ndims:1开始:0计数:720 ncvar_get_inner(d $ dimvarid $ group_id,d $ dimvarid $ id,default_missval_ncdf4(),中的错误: C函数R_nc4_get_vara_double返回错误
所以我在代码中添加了此代码:nc = nc_open(文件名,write = FALSE,readunlim = TRUE,verbose = FALSE,auto_GMT = TRUE,suppress_dimvals = TRUE),并且它可以正常工作。 但是,当我尝试提取所有时间步长(720)的速度时,出现以下错误消息:
Rsx_nc4_get_vara_double中的错误:NetCDF:HDF错误 Var:vozocrtx Ndims:4 Start:0,0,0,0 Count:720,75,300,580 ncvar_get_inner(ncid2use,varid2use,nc $ var [[li]] $ missval,addOffset 、: C函数R_nc4_get_vara_double返回错误
有什么办法可以解决这个问题吗?
我提取R上的速度数据的代码是:
velocity_u <-ncvar_get(nc,“ vozocrtx”,start = c(1,1,1,1),count = c(580,300,75,720))
当我执行print(nc)时,我的文件如下所示: 文件SOice_1h_20090131_20090301_grid_U.nc(NC_FORMAT_NETCDF4):
7 variables (excluding dimension variables):
float nav_lat[x,y] (Chunking: [580,300])
standard_name: latitude
long_name: Latitude
units: degrees_north
nav_model: grid_U
float nav_lon[x,y] (Chunking: [580,300])
standard_name: longitude
long_name: Longitude
units: degrees_east
nav_model: grid_U
float depthu_bounds[axis_nbounds,depthu] (Chunking: [2,75])
float vozocrtx[x,y,depthu,time_counter] (Chunking: [580,300,75,1])
standard_name: sea_water_x_velocity
long_name: ocean current along i-axis
units: m/s
online_operation: average
interval_operation: 60 s
interval_write: 1 h
cell_methods: time: mean (interval: 60 s)
_FillValue: 1.00000002004088e+20
missing_value: 1.00000002004088e+20
coordinates: time_centered depthu nav_lat nav_lon
double time_centered[time_counter] (Chunking: [1])
standard_name: time
long_name: Time axis
calendar: noleap
units: seconds since 1900-01-01 00:00:00
time_origin: 1900-01-01 00:00:00
bounds: time_centered_bounds
double time_centered_bounds[axis_nbounds,time_counter] (Chunking: [2,1])
double time_counter_bounds[axis_nbounds,time_counter] (Chunking: [2,1])
5 dimensions:
axis_nbounds Size:2
x Size:580
y Size:300
depthu Size:75
long_name: Vertical U levels
units: m
axis: Z
positive: down
bounds: depthu_bounds
time_counter Size:720 *** is unlimited ***
axis: T
standard_name: time
long_name: Time axis
calendar: noleap
units: seconds since 1900-01-01 00:00:00
time_origin: 1900-01-01 00:00:00
bounds: time_counter_bounds
6 global attributes:
name: SOice_1h_20090131_20090301
description: ocean U grid variables
title: ocean U grid variables
Conventions: CF-1.5
production: An IPSL model
timeStamp: 2018-Feb-09 19:13:31 GMT
使用以下代码,它直到650才开始第一次工作: velocity_u <-ncvar_get(nc,“ vozocrtx”,start = c(1,1,1,1),count = c(580,300,75,684))
在684之后,我收到此错误消息:
Rsx_nc4_get_vara_double中的错误:NetCDF:HDF错误 Var:vozocrtx Ndims:4 Start:0,0,0,0 Count:685,75,300,580 ncvar_get_inner(ncid2use,varid2use,nc $ var [[li]] $ missval,addOffset 、: C函数R_nc4_get_vara_double返回错误