[R-sig-Geo] spacetime EOF error "variable names are limited to 10000 bytes"

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Oct 14 09:27:00 CEST 2014


Thanks for the clear example & diagnostic.

I committed a patch (github) that now uses the first name only to
address all layers (i.e.: "layer.1"). I'm all ears for a better suggestion!

On 10/14/2014 08:00 AM, Frede Aakmann Tøgersen wrote:
> Hi Andrew
> 
> Try this
> 
>> nchar(names(stfdf at data))
> [1] 108893
>>
> 
> Really long name. Here is a snipped version.
> 
>> names(stfdf at data)
> [1] "layer.1.layer.2.layer.3.layer.4.layer.5.layer.6.layer.7.layer.8.layer.9.layer.10.layer.11.layer.12.layer.13.layer.14.layer.15.layer.16.layer.17.layer.18.layer.19.layer.20.layer.21.layer.22.layer.23.layer.24.layer.25.layer.26.layer.27.layer.28.layer.29.layer.30.layer.31.layer.32.layer.33.layer.34.layer.35.layer.36.layer.37.layer.38.layer.39.layer.40.layer.41.layer.42.layer.43.layer.44.layer.45.layer.46.layer.47.layer.48.layer.49.layer.50.layer.51.layer.52.layer.53.layer.54.layer.55.layer.56.layer.57.layer.58.layer.59.layer.60.layer.61.layer.62.layer.63.layer.64.layer.65.layer.66.layer.67.layer.68.layer.69.layer.70.layer.71.layer.72.layer.73.layer.74.layer.75.layer.76.layer.77.layer.78.layer.79.layer.80.layer.81.layer.82.layer.83.layer.84.layer.85.layer.86.layer.87.layer.88.layer.89.layer.90.layer.91.layer.92.layer.93.layer.94.layer.95.layer.96.layer.97.layer.98.layer.99.layer.100.layer.101.layer.102.layer.103.layer.104.layer.105.layer.106.layer.107.layer.108.layer.109.layer.110.
layer.111.layer.112.layer.113.layer.114.layer.115.layer.116.layer.117.layer.118.layer.119.layer.120.layer.121.layer.122.layer.123.layer.124.layer.125.layer.126.layer.127.layer.128.layer.129.layer.130.layer.131.layer.132.layer.133.layer.134.layer.135.layer.136.layer.137.layer.138.layer.139.layer.140.lay
>  < SNIP> 946.layer.9947.layer.9948.layer.9949.layer.9950.layer.9951.layer.9952.layer.9953.layer.9954.layer.9955.layer.9956.layer.9957.layer.9958.layer.9959.layer.9960.layer.9961.layer.9962.layer.9963.layer.9964.layer.9965.layer.9966.layer.9967.layer.9968.layer.9969.layer.9970.layer.9971.layer.9972.layer.9973.layer.9974.layer.9975.layer.9976.layer.9977.layer.9978.layer.9979.layer.9980.layer.9981.layer.9982.layer.9983.layer.9984.layer.9985.layer.9986.layer.9987.layer.9988.layer.9989.layer.9990.layer.9991.layer.9992.layer.9993.layer.9994.layer.9995.layer.9996.layer.9997.layer.9998.layer.9999.layer.10000"
>>
> 
> If you do this:
> 
> names(stfdf at data) <- "all_layers"
> 
> EOF() will work.
> 
> 
> Yours sincerely / Med venlig hilsen
> 
> 
> Frede Aakmann Tøgersen
> Specialist, M.Sc., Ph.D.
> Plant Performance & Modeling
> 
> Technology & Service Solutions
> T +45 9730 5135
> M +45 2547 6050
> frtog at vestas.com
> http://www.vestas.com
> 
> Company reg. name: Vestas Wind Systems A/S
> This e-mail is subject to our e-mail disclaimer statement.
> Please refer to www.vestas.com/legal/notice
> If you have received this e-mail in error please contact the sender. 
> 
>> -----Original Message-----
>> From: r-sig-geo-bounces at r-project.org [mailto:r-sig-geo-bounces at r-
>> project.org] On Behalf Of Andrew Vitale
>> Sent: 14. oktober 2014 01:24
>> To: r-sig-geo
>> Subject: [R-sig-Geo] spacetime EOF error "variable names are limited to
>> 10000 bytes"
>>
>> Hello,
>>
>> I have a raster brick of sea level pressure anomalies that I would like to
>> analyze using empirical orthogonal functions.  Each layer of the brick
>> represents a daily observation, with a total of 20,718 days worth of
>> observations (nlayer=20,718).
>>
>> I can easily coerce the raster brick to a spacetime STFDF object.  However,
>> when I try to run the spacetime:::EOF function, I get the following error:
>> "Error in eval(as.call(c(expression(data.frame), x, check.names =
>> !optional,  :
>>    variable names are limited to 10000 bytes"
>>
>> It seems that the error originates from the third line of the EOF code,
>> where the STFDF is coerced to an xts object.
>>
>> Does anyone know of a workaround for this error, or is this merely a
>> limitation of R?
>>
>> Here's a code that mimics my issue and my sessionInfo():
>>
>> library(raster)
>> library(spacetime)
>>
>> ## Create a raster object that mimics my data
>> ## I actually have 20,708 layers in the raster stack
>> a = array(rnorm(9*9*10000), c(9,9,10000))
>> b = brick(a)
>> b = setValues(b, a)
>> z = seq(as.Date('1980-01-01'), as.Date('2007-05-18'),
>>         by = 'day')
>> b = setZ(b, z)
>>
>> ## coerce the raster stack to an STFDF object
>> stfdf = as(b, 'STFDF')
>>
>> ## attempt to compute EOFs
>> eof_time = EOF(stfdf, 'temporal')
>> eof_space = EOF(stfdf, 'space')
>>
>> #### restultant error:
>> # Error in eval(as.call(c(expression(data.frame), x, check.names =
>> !optional,  :
>> #   variable names are limited to 10000 bytes
>>
>> # > sessionInfo()
>> # R version 3.1.1 (2014-07-10)
>> # Platform: x86_64-pc-linux-gnu (64-bit)
>>
>> # locale:
>> #  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>> #  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>> #  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>> #  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>> #  [9] LC_ADDRESS=C               LC_TELEPHONE=C
>> # [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>> # attached base packages:
>> # [1] grid      stats     graphics  grDevices utils     datasets  methods
>> # [8] base
>>
>> # other attached packages:
>> # [1] spacetime_1.1-0 ncdf4_1.13      fields_7.1      maps_2.3-7
>> # [5] spam_1.0-1      rgdal_0.8-16    raster_2.2-31   sp_1.0-15
>>
>> # loaded via a namespace (and not attached):
>> # [1] intervals_0.14.0 lattice_0.20-29  rgeos_0.3-4      tcltk_3.1.1
>> # [5] tools_3.1.1      xts_0.9-7        zoo_1.7-11
>>
>>
>>
>>
>> Thanks,
>> Andrew
>> --
>> *Andrew P. Vitale*
>> Masters Student
>> Department of Geography
>> University of Nevada, Reno
>> vitale232 at gmail.com
>>
>> 	[[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

-- 
Edzer Pebesma,  Co-Editor-in-Chief Computers & Geosciences
Institute for Geoinformatics (ifgi), University of Münster
Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20141014/e9b7c01d/attachment.bin>


More information about the R-sig-Geo mailing list