[R] ncdf size error

Hernan A. Moreno Ramirez hmorenor at uwyo.edu
Tue Sep 16 20:36:21 CEST 2014


Sure, here it is. Thanks for any help with this Dr. Pierce:


##### Exporting to NETCDF files #################################################################
# define the netcdf coordinate variables 
library(ncdf)
dim1 = dim.def.ncdf( "Nodes","", seq(1,19000))
dim2= dim.def.ncdf( "Time","Hours since 2005-01-01 00:00:00",seq(1:2190)) #final[1,2,]))

varT2 = var.def.ncdf("T2","celsius", list(dim1,dim2), -99999, longname="T2")
varQ2 = var.def.ncdf("Q2","kg kg-1", list(dim1,dim2), -99999, longname="Q2")
varQVAPOR = var.def.ncdf("QVAPOR","kg kg-1", list(dim1,dim2), -99999, longname="QVAPOR")
varQCLOUD = var.def.ncdf("QCLOUD","kg kg-1", list(dim1,dim2), -99999, longname="QCLOUD")
varPSFC = var.def.ncdf("PSFC","Pa", list(dim1,dim2), -99999, longname="PSFC")
varW10 = var.def.ncdf("W10","ms-1", list(dim1,dim2), -99999, longname="W10")
varW = var.def.ncdf("W","ms-1", list(dim1,dim2), -99999, longname="W")
varVEGFRA = var.def.ncdf("VEGFRA","", list(dim1,dim2), -99999, longname="VEGFRA")
varMAXVEGFRA = var.def.ncdf("MAXVEGFRA","", list(dim1,dim2), -99999, longname="MAXVEGFRA")
varTPREC = var.def.ncdf("TPREC","mm", list(dim1,dim2), -99999, longname="TPREC")
varFRAC_FROZ_PREC = var.def.ncdf("FRAC_FROZ_PREC","mm", list(dim1,dim2), -99999, longname="FRAC_FROZ_PREC")
varSWDOWN = var.def.ncdf("SWDOWN","W m-2", list(dim1,dim2), -99999, longname="SWDOWN")
varGLW = var.def.ncdf("GLW","W m-2", list(dim1,dim2), -99999, longname="GLW")
varPBLH = var.def.ncdf("PBLH","m", list(dim1,dim2), -99999, longname="PBLH")
varTSLB = var.def.ncdf("TSLB","Celsius", list(dim1,dim2), -99999, longname="TSLB")

# associate the netcdf variable with a netcdf file   
# put the variable into the file, and
# close

nc.ex = create.ncdf("/media/D/output.nc",list(varT2, varQ2, varQVAPOR, varQCLOUD, varPSFC, varW10, varW, varVEGFRA, varMAXVEGFRA, varTPREC, varFRAC_FROZ_PREC, varSWDOWN, varGLW, varPBLH, varTSLB))

Error in R_nc_enddef: NetCDF: One or more variable sizes violate format constraints
Error in R_nc_sync: NetCDF: Operation not allowed in define mode

---------------------------------------------------------------------------------------
Hernan A. Moreno, Ph.D.
Postdoctoral Research Associate
Department of Civil & Architectural Engineering
Room 3038, Engineering Building
University of Wyoming
Phone: 480-3990571
http://www.public.asu.edu/~hamoreno/

________________________________________
From: davidwilliampierce at gmail.com <davidwilliampierce at gmail.com> on behalf of David W. Pierce <dpierce at ucsd.edu>
Sent: Monday, September 15, 2014 7:00 PM
To: Hernan A. Moreno Ramirez
Cc: r-help at r-project.org
Subject: Re: [R] ncdf size error

On Mon, Sep 15, 2014 at 4:20 PM, Hernan A. Moreno Ramirez
<hmorenor at uwyo.edu> wrote:
>
> Hi I am using both ncdf and ncdf4 libraries and with both I keep getting the
> same error: Error in R_nc_enddef: NetCDF: One or more variable sizes violate
> format constraints. Error in R_nc_sync: NetCDF: Operation not allowed in
> define mode. This happens when I try to create.ncdf() a file with more than
> 13 variables. I think is a problem of memory size. What would you recommend?
> Any help will be appreciated

Hi Hernan,

can you supply an example that shows the problem?

Regards,

--Dave

-------------------
David W. Pierce
Division of Climate, Atmospheric Science, and Physical Oceanography
Scripps Institution of Oceanography, La Jolla, California, USA
(858) 534-8276 (voice)  /  (858) 534-8561 (fax)    dpierce at ucsd.edu



More information about the R-help mailing list