[R] Please help

Pascal Oettli kridox at ymail.com
Wed Jul 4 11:39:29 CEST 2012


Following lines are wrong:
> x=dim.def.ncdf("Lon","degreesE",140.0251:146.6751)
> y=dim.def.ncdf("Lat","degreesN",(-31.025):(-38.975))

You have 241 longitudes and 160 latitudes.
lon <- seq(from=140.0251, to=146.6751, length.out=241)
lat <- seq(from=-38.975, to=-31.025, length.out=160)


----- Mail original -----
De : Jun Chen <chenshong at hotmail.com>
À : r-help at r-project.org
Cc : 
Envoyé le : Mercredi 4 juillet 2012 10h52
Objet : [R] Please help

Dear All,
           I am a research student in environment. I have only little programming knowledge. I am currently doing the last project about rainfall impact on ground water quality in an area. It happens that I have to use R to read rainfall data (3 dimension) from ASC file (*.asc), and then write them into one NCDF file (*.nc).

           I have been working very hard on study R, but I still can not fix the problem. Could someone please as kind as point out that what the problems are in my R script?

         Firstly, this is an example of data in asc file:
                    NCOLS      241

                    NROWS      160

                    XLLCORNER    140.00012207031    

                    YLLCORNER   -39.000000000000    

                    CELLSIZE    0.50000000000000E-01

                    NODATA_VALUE   -99.00000    

                    166.30  160.87  155.23  149.33  143.83  138.52  133.29  128.34  123.76  119.21

                    115.06  110.90  107.22  103.69  100.40   97.29   94.58   92.15   90.00   87.91

                    86.20   84.57   83.22   81.94   81.11   80.38   79.37   78.73   79.70   79.62

          And then this is the script I wrote:


#defining dimension




#setup variable


longname="monthly rainfall")

#create ncdf file

ncnew=create.ncdf("rainfall.nc", varmr)

#read input



for(i in files)




put.var.ncdf(ncnew, mrain)



[[elided Hotmail spam]]

Many thanks,

    [[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list