[R] reading dataset

Pascal Oettli kridox at ymail.com
Thu Mar 27 04:39:30 CET 2014


Hello,

Some hints:
   - for the year 1961, the total number of values is 27594000,
   - there are 180 longitudes and 140 latitudes,
   - there are 365 days,
   - there are 3 variables,

Compare the total number of values and the result of (180 x 140 x 365 x 3).

The order is "precip", "rstn", "flag", "precip", "rstn", "flag",
"precip", "rstn", "flag"...

Hope this helps,
Pascal

On Thu, Mar 27, 2014 at 9:45 AM, eliza botto <eliza_botto at hotmail.com> wrote:
> Dear useRs,
> A similar question has previously been asked by another user (https://stat.ethz.ch/pipermail/r-sig-geo/2011-September/012791.html) but i'll try to discuss it from another angle. Its about data reading. I am trying to read to read a data-set APHRO_MA_050deg_V1101R2.1961.gz from http://www.chikyu.ac.jp/precip/cgi-bin/aphrodite/script/aphrodite_cgi.cgi/download?file=%2FV1101R2%2FAPHRO_MA%2F050deg.
> I copied the command from previous post which is
> ccc <-readBin("APHRO_MA_050deg_V1101R2.1961", numeric(), n=1e8, size=4, signed=TRUE, endian='little')
> Followings are what I know about the structure of data set. The file contains daily fields for 365 days. These daily fields are arranged according to the Julian calendar.  Daily
> fields (data arrays) contain information on the precipitation amount and
> ratio of 0.05-degree cells containing a rain gauge.  In the case the given file which is a
> 0.5-degree grid file, each field consists of a data array with longitude
> by latitude dimensions of  180 x 140 elements for APHRO_MA.
>  The first element is a cell at the southwest corner centered at [60.25E, 14.75S], the second
> is a cell at [60.75E, 14.75S], ..., the 180th is a cell at [149.75E,
> 14.75S], and the 181st is a cell at [60.25E, 14.25S]. The data files are written in PLAIN DIRECT ACCESS BINARY.  In each daily field, the array for precipitation comes first, followed by
> information on the rain gauge. Each element (both precipitation and
> rain gauge information) is written as a 4-byte floating-point number
> in little endian byte order.  Users should swap the byte order to
> big endian if necessary.  There are no 'space', 'end of record', or
> 'end of file' marks in between.  As it says that precipitation data is in the form of array which comes first, followed by the information on rain gauge, how do I know which element is precipitation data and which is the information of the rain gauge?Thankyou very  much in advance
>
> Eliza
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan




More information about the R-help mailing list