[R] Help asked for automated generation of ncdf variables
David Pierce
dpierce at ucsd.edu
Tue Jun 29 17:57:51 CEST 2010
> Date: Wed, 16 Jun 2010 17:53:56 +0200
> From: "Adolf STIPS" <adolf.stips at jrc.ec.europa.eu>
>
> Hi,
>
> I'm using the "ncdf" library for creating ncdf files.
> But I need to create about 100 variables per file (e.g. single rivers),
> So I do not like to create each variable separately.
>
> Unfortunately I found no way to make this work, as I'm unable to create a
> correct list of class "var.ncdf".
Hello,
the var.def.ncdf() call returns an object of class var.ncdf. Since
objects are lists, you can't assign them to arrays. However, you can
easily assign them to other lists. So instead of this:
> riv=
> var.def.ncdf(nam,"m**3/s",d1,msvf,longname=names[iriv],prec="single")
> #class(river[iriv]) ="var.ncdf"
> river[iriv] = riv
> }
>
> ncw=create.ncdf(wfile,list(river))
Try something this:
river = list()
> riv=
> var.def.ncdf(nam,"m**3/s",d1,msvf,longname=names[iriv],prec="single")
> river[[iriv]] = riv
> }
>
> ncw=create.ncdf(wfile,river)
Regards,
--Dave
More information about the R-help
mailing list