Hello, I have been having difficulties opening netcdf files using the netcdf library. I am able to successfully open the file and I can determine the names and size. However, when I try to read it I receive an error. Reading the documentation, I am wondering if this might be due to a difference between netcdf version 2 and more recent netcdf format? I've tried using different values for the count option without luck. I have had success reading this file into matlab.> library(netCDF) > aaa<- open.netCDF("/scratch/pocernic/int_fcst.20021201.0010.nc") > class(aaa)[1] "netCDF"> summary(aaa)netCDF file /scratch/pocernic/int_fcst.20021201.0010.nc is open $types [1] "integer" "numeric" "numeric" "integer" "integer" "integer" "single" [8] "single" "single" "single" "single" "single" "single" "single" [15] "single" "single" "single" "single" "single" "single" "single" [22] "single" "single" "single" "single" ... etc ## when I try to read it, I get the following error.> bbb<- read.netCDF(aaa)Error: dim: Invalid dimension vector Thanks Matt Matt Pocernich NCAR - Research Applications Group 303-497-8312
Hi Matt, I use the following procedure after opening a netcdf file: library(netCDF) wind<-read.netCDF("C:/To?o/datos/fnomc_nc/wind.nc") str(wind) a<-wind$"UV_MAG_MEAN" a[a == attributes(a)$"missing_value"] <- NA dimnames(a) <- list(wind$"TIME_SERIES",wind$"LAT125_128",wind$"LON351_354") Hope this helps Cheers, Antonio Rodriguez
hi matt, the netcdf stuff has worked on anything I can dump with ncdump. try:> aaa<- open.netCDF("/scratch/pocernic/int_fcst.20021201.0010.nc") > names(aaa)..."VAR"> var<- read.netcdf(aaa,"VAR")or as slabs> var <- as.vector(read.netCDF(aaa, name="VAR", byrow=F, start=512,count=512,attr=F)) Yours, pdev. ********************************DISCLAIMER**************************** The information contained in the above e-mail message or messages (which includes any attachments) is confidential and may be legally privileged. It is intended only for the use of the person or entity to which it is addressed. If you are not the addressee any form of disclosure, copying, modification, distribution or any action taken or omitted in reliance on the information is unauthorised. Opinions contained in the message(s) do not necessarily reflect the opinions of the Queensland Government and its authorities. If you received this communication in error, please notify the sender immediately and delete it from your computer system network.