metno / esd

An R-package designed for climate and weather data analysis, empirical-statistical downscaling, and visualisation.
88 stars 30 forks source link

Example 5.1 metreport4esd #221

Closed bczernecki closed 7 years ago

bczernecki commented 7 years ago

Hi, Today I've found another strange error related with applying list of EOF predictors for DS() as described in the example 5.1 (metreport4esd, p. 49):

data(eof.t2m.NCEP) data(eof.slp.NCEP) data(Oslo) z <- DS(y=Oslo,X=list(t2m=eof.slp.NCEP,slp=eof.t2m.NCEP),mon=1, weighted=T,verbose=T) [1] "--- DS.station ---" [1] "mon= 1" [1] "The predictor is a list" [1] "DS.list" [1] "t2m" "slp" [1] "Several predictors" [1] "as.eof.list" Length Class Mode t2m 15660 eof numeric slp 15660 eof numeric Index slp.1 slp.2 Min. :1948-01-01 Min. :-0.0289277 Min. :-0.012151 1st Qu.:1964-04-16 1st Qu.:-0.0160521 1st Qu.:-0.002739 Median :1980-08-01 Median : 0.0006953 Median : 0.001135 Mean :1980-07-31 Mean : 0.0000000 Mean : 0.000000 3rd Qu.:1996-11-16 3rd Qu.: 0.0157164 3rd Qu.: 0.003560 Max. :2013-03-01 Max. : 0.0249869 Max. : 0.008954 slp.3 slp.4 slp.5 Min. :-0.0043776 Min. :-4.037e-03 Min. :-2.826e-03 1st Qu.:-0.0016449 1st Qu.:-7.820e-04 1st Qu.:-9.163e-04 Median :-0.0004089 Median : 5.007e-06 Median : 3.464e-05 Mean : 0.0000000 Mean : 0.000e+00 Mean : 0.000e+00 3rd Qu.: 0.0015649 3rd Qu.: 7.278e-04 3rd Qu.: 9.114e-04 Max. : 0.0058965 Max. : 5.789e-03 Max. : 2.641e-03 slp.6 slp.7 slp.8 Min. :-4.039e-03 Min. :-3.307e-03 Min. :-2.583e-03 1st Qu.:-7.186e-04 1st Qu.:-5.846e-04 1st Qu.:-5.495e-04 Median : 2.248e-05 Median :-2.150e-07 Median : 8.634e-06 Mean : 0.000e+00 Mean : 0.000e+00 Mean : 0.000e+00 3rd Qu.: 7.530e-04 3rd Qu.: 6.257e-04 3rd Qu.: 5.398e-04 Max. : 3.524e-03 Max. : 3.227e-03 Max. : 2.393e-03 slp.9 slp.10 slp.11 Min. :-3.204e-03 Min. :-2.744e-03 Min. :-3.619e-03 1st Qu.:-4.931e-04 1st Qu.:-5.219e-04 1st Qu.:-4.396e-04 Median :-1.948e-06 Median :-2.246e-06 Median :-3.421e-05 Mean : 0.000e+00 Mean : 0.000e+00 Mean : 0.000e+00 3rd Qu.: 5.432e-04 3rd Qu.: 4.675e-04 3rd Qu.: 4.489e-04 Max. : 2.329e-03 Max. : 2.434e-03 Max. : 2.304e-03 slp.12 slp.13 slp.14 Min. :-2.597e-03 Min. :-2.258e-03 Min. :-1.907e-03 1st Qu.:-4.032e-04 1st Qu.:-3.857e-04 1st Qu.:-3.595e-04 Median : 1.262e-05 Median :-1.817e-05 Median :-7.099e-06 Mean : 0.000e+00 Mean : 0.000e+00 Mean : 0.000e+00 3rd Qu.: 4.286e-04 3rd Qu.: 4.261e-04 3rd Qu.: 3.572e-04 Max. : 1.820e-03 Max. : 2.227e-03 Max. : 2.543e-03 slp.15 slp.16 slp.17 Min. :-1.739e-03 Min. :-1.883e-03 Min. :-1.541e-03 1st Qu.:-3.697e-04 1st Qu.:-3.333e-04 1st Qu.:-3.554e-04 Median :-1.417e-05 Median : 1.111e-05 Median : 1.819e-05 Mean : 0.000e+00 Mean : 0.000e+00 Mean : 0.000e+00 3rd Qu.: 3.784e-04 3rd Qu.: 3.540e-04 3rd Qu.: 3.186e-04 Max. : 1.599e-03 Max. : 1.884e-03 Max. : 1.643e-03 slp.18 slp.19 slp.20 Min. :-1.577e-03 Min. :-2.041e-03 Min. :-0.0014122 1st Qu.:-3.225e-04 1st Qu.:-2.803e-04 1st Qu.:-0.0003353 Median :-2.846e-05 Median :-9.708e-06 Median :-0.0000171 Mean : 0.000e+00 Mean : 0.000e+00 Mean : 0.0000000 3rd Qu.: 3.136e-04 3rd Qu.: 2.824e-04 3rd Qu.: 0.0003288 Max. : 1.705e-03 Max. : 1.819e-03 Max. : 0.0016492 [1] "DS(y,eof,...)" [1] "--- DS.station ---" [1] "i= 1" [1] "station" "month" "zoo" [1] "index" "class" "location" "variable" "unit" [6] "longitude" "latitude" "altitude" "country" "longname" [11] "station_id" "quality" "calendar" "source" "URL" [16] "type" "reference" "info" "method" "history" [1] "The predictor is some kind of EOF-object" [1] "*** EOF ***" [1] "--- DS.default ---" [1] "index(y)" [1] 1837 1837 1837 1837 1837 1837 1837 1837 1837 1837 1837 1837 1838 1838 [15] 1838 1838 1838 1838 1838 1838 1838 1838 1838 1838 1839 1839 1839 1839 (...) [2143] 2015 2015 2015 2015 2015 2015 2016 2016 2016 2016 2016 2016 2016 2016 [2157] 2016 2016 2016 2016 2017 2017 2017 2017 [1] "station" "month" "zoo" [1] "eof" "field" "month" "zoo" [1] "3 missing values in y" [1] "index(y) before removing missing values:" [1] 1837 1837 1837 1837 1837 1837 1837 1837 1837 1837 1837 1837 1838 1838 [15] 1838 1838 1838 1838 1838 1838 1838 1838 1838 1838 1839 1839 1839 1839 (...) [2143] 2015 2015 2015 2015 2015 2015 2016 2016 2016 2016 2016 2016 2016 2016 [2157] 2016 2016 2016 2016 2017 2017 2017 2017 [1] "Ensure matching time scale" [1] "index(y) before sametimescale:" [1] 1837 1837 1837 1837 1837 1837 1837 1837 1837 1838 1838 1838 1838 1838 (...) [2157] 2016 2017 2017 2017 2017 [1] "sametimescale" [1] "month" "month" [1] "matchdate: t = [ 1837 - 2017 ], it= [ 1948 - 2013 ]" [1] "1837-01-01" "1948-01-01" "1975-05-03" [1] "select 783 dates" [1] "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" [6] "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" (...) [766] "2011-01-01" "2011-01-01" "2011-01-01" "2012-01-01" "2012-01-01" [771] "2012-01-01" "2012-01-01" "2012-01-01" "2012-01-01" "2012-01-01" [776] "2012-01-01" "2012-01-01" "2012-01-01" "2012-01-01" "2012-01-01" [781] "2013-01-01" "2013-01-01" "2013-01-01" [1] "783 matching dates" [1] "matchdate: index(y)" [1] 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1949 1949 1949 (...) [766] 2011 2011 2011 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 [781] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 [1] "matchdate: t = [ 1948 - 2013 ], it= [ 1948 - 2013 ]" [1] "1948-01-01" "1948-01-01" "1975-05-03" [1] "select 792 dates" [1] "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" [6] "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" "1948-01-01" (...) [786] "2013-01-01" "2013-01-01" "2013-01-01" "2013-01-01" "2013-01-01" [791] "2013-01-01" "2013-01-01" [1] "792 matching dates" [1] "matchdate: index(y)" [1] 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1949 1949 1949 (...) [766] 2011 2011 2011 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 [781] 2013 2013 2013 [1] "index(y) & index(X) after synch:" [1] 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1949 1949 1949 (...) [766] 2011 2011 2011 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 [781] 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 2013 [1] 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1948 1949 1949 1949 (...) [751] 2010 2010 2010 2010 2010 2010 2011 2011 2011 2011 2011 2011 2011 2011 2011 [766] 2011 2011 2011 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 2012 [781] 2013 2013 2013 [1] "detrend" [1] "weights FALSE" [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1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 1 1 1 1 1 1 1 1 1 1 1 [556] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [593] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [630] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [667] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [704] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [741] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [778] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Error in data.frame(y = coredata(y), X = as.matrix(coredata(X)), weights = weights) : arguments imply differing number of rows: 792, 783 In addition: There were 50 or more warnings (use warnings() to see the first 50) # the same error for every station.. #z <- DS(y=Oslo,X=list(t2m=eof.slp.NCEP,slp=eof.t2m.NCEP),mon=1, verbose=T

After looking at warnings() this is what I've got:`

warnings() Warning messages: 1: In DS.station(y = Oslo, X = list(t2m = eof.slp.NCEP, slp = eof.t2m.NCEP), ... : DS.station: different indices: Date integer 2: In zoo(as.matrix(coredata(x)), order.by = index(x)) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 3: In zoo(rval, index(x)[i]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 4: In DS.station(y, eof, biascorrect = biascorrect, method = method, ... : DS.station: different indices: numeric Date 5: In zoo(as.matrix(coredata(x)), order.by = index(x)) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 6: In zoo(rval, index(x)[i]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 7: In zoo(as.matrix(coredata(x)), order.by = index(x)) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 8: In zoo(rval, index(x)[i]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 9: In zoo(rval[i], index(x)[i]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique 10: In zoo(rval, index(x)[i]) : some methods for “zoo” objects do not work if the index entries in ‘order.by’ are not unique (...)

And my sessionInfo():

R version 3.4.0 (2017-04-21) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.2 LTS

Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.6.0 LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

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] stats graphics grDevices utils datasets methods base

other attached packages: [1] esd_1.6294 zoo_1.8-0 ncdf4_1.16

loaded via a namespace (and not attached): [1] compiler_3.4.0 tools_3.4.0 grid_3.4.0 lattice_0.20-35

Best, Bartek

Ps. I can give you access by ssh if it helps you debug this issue as it looks very similar to #220.

erlekr commented 7 years ago

I have the same problem...

abdelkaderm commented 7 years ago

Dears,

We have not been able to test extensively DS.list() function due to lack of time. But will try to fix it as soon as possible.

Bests,

brasmus commented 7 years ago

Fixed.

Rasmus