TableData.st
author Claus Gittinger <cg@exept.de>
Tue, 05 Nov 2019 15:45:01 +0100
changeset 5232 a99483a7340f
parent 4973 084da8f61316
child 5233 cdc7441f8520
permissions -rw-r--r--
#DOCUMENTATION by exept class: TableData added: #dwd_extractMonth: #dwd_extractMonth:columnName: #dwd_extractMonth:columnName:format: #dwd_extractMonth:day: #dwd_extractMonth:day:columnName:format: #dwd_meanPerMonthOfColumnNamed: #dwd_meanPerYearOfColumnNamed: #masie_meanPerMonthOfColumnNamed: #readCSV:separator:skip: #readCSV:skip: removed: #extractMonth: #extractMonth:columnName: #extractMonth:columnName:format: #extractMonth:day: #extractMonth:day:columnName:format: #meanPerMonthOfColumnNamed: #meanPerYearOfColumnNamed: changed: #plot:file: #readCSV: #readCSV:separator: category of: #writeCSVToStream: class: TableData class added: #examples comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4789
4daaaab89349 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
     1
"{ Encoding: utf8 }"
4daaaab89349 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
     2
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ Package: 'stx:libbasic2' }"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
"{ NameSpace: Smalltalk }"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
Object subclass:#TableData
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	instanceVariableNames:'rowData columnNames columnTypes tableName'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
	classVariableNames:''
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
	poolDictionaries:''
4973
084da8f61316 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
    11
	category:'Collections-Sequenceable-Table'
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
!TableData class methodsFor:'documentation'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
documentation
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
    17
"   Unfinished
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
    Ongoing work to support some algorithms on table data (such as CSV files).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
    Snippets to read and process tabular (CSV) data
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
    21
    Snippets to generate a plot.
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
    23
    The category DWD (Deutscher Wetter Dienst / German weather service)
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
    24
    contains specific code to deal with historic weather data.
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    25
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    26
    plot requires the r language to be installed (uses 'r' command).
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    27
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
    [author:]
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
        Claus Gittinger
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
    [instance variables:]
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
        rowData                 the actual data
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
        columnNames             name per column 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
        columnTypes             type per column (default is String)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
        tableName               name - only used for labeling graphs
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
    [class variables:]
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    [see also:]
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
"
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    42
!
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    43
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    44
examples
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    45
"  
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    46
     self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    47
        readCSV:'/Users/exept/Downloads/masie_4km_allyears_extent_sqkm.csv';
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    48
        inspect.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    49
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    50
     ((self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    51
        readCSV:'/Users/exept/Downloads/masie_4km_allyears_extent_sqkm.csv' separator:$, skip:1)
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    52
            masie_meanPerMonthOfColumnNamed:'(0) Northern_Hemisphere')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    53
                plot
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    54
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    55
     '/tmp/xxx.csv' asFilename writingFileDo:[:s |
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    56
        ((self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    57
            readCSV:'/Users/exept/Downloads/masie_4km_allyears_extent_sqkm.csv' separator:$, skip:1)
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    58
                masie_meanPerMonthOfColumnNamed:'(0) Northern_Hemisphere')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    59
                    writeCSVToStream:s
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    60
      ]  
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
    61
"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
!TableData class methodsFor:'instance creation'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
fromFile:filename
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    ^ self new readCSV:filename
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
     self fromFile:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    "Created: / 06-01-2019 / 13:28:53 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    "Modified: / 09-01-2019 / 12:08:02 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
rows:rowData columnNames:names
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    ^ self new rows:rowData columnNames:names
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    "Created: / 06-01-2019 / 13:25:37 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
rows:rowData columnNames:names tableName:tableName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    ^ self new rows:rowData columnNames:names tableName:tableName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    "Created: / 06-01-2019 / 19:24:47 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
!TableData methodsFor:'accessing'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
getColumn:index
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
    92
    "return a column (by index) as a vector"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    ^ rowData collect:[:row | row at:index].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
        getColumn:1.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    "Created: / 06-01-2019 / 19:04:08 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   103
    "Modified (comment): / 30-05-2019 / 11:29:54 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
getColumnNamed:name
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   107
    "return a column (by name) as a vector"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   108
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    ^ self getColumn:(self indexOfColumnNamed:name)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
        getColumnNamed:'TXK'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
    "Created: / 06-01-2019 / 19:04:24 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   120
    "Modified (comment): / 30-05-2019 / 11:30:00 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
getColumns:indexCollection
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   124
    "return multiple columns (by index vector) as a vector of columns"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   125
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    ^ rowData collect:[:row | 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
        indexCollection collect:[:eachColIdx | row at:eachColIdx] as:Array.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    ].        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
        getColumns:#(1 2 3).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    "Created: / 06-01-2019 / 19:04:47 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   137
    "Modified (comment): / 30-05-2019 / 11:30:30 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
getColumnsNamed:names
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   141
    "return multiple columns (by name vector) as a vector of columns"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   142
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
    |colsIndices|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    colsIndices := names collect:[:eachName | self indexOfColumnNamed:eachName].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    ^ self getColumns:colsIndices
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
        getColumnsNamed:#('MESS_DATUM' 'TXK' 'TNK').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    "Created: / 06-01-2019 / 19:04:56 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   157
    "Modified (comment): / 30-05-2019 / 11:30:41 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
tableName:aString
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   161
    "set the table's name"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   162
    
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    tableName := aString.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   165
    "Modified (comment): / 30-05-2019 / 11:30:52 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
tableNamePrefix:aString
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   169
    "prepend a prefix to the table's name"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   170
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    tableName := aString,tableName.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    "Created: / 06-01-2019 / 21:13:12 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   174
    "Modified (comment): / 30-05-2019 / 11:31:08 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
tableNameSuffix:aString
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   178
    "append a suffix to the table's name"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   179
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    tableName := tableName,aString.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    "Created: / 06-01-2019 / 21:13:01 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   183
    "Modified (comment): / 30-05-2019 / 11:31:17 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
!TableData methodsFor:'analysis'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
addBincoSlidingMean3ForColumnNamed:colName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    "add a column with the sliding binco mean (1/4 + 1/2 + 1/4).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
     As binco:3 is quite common,
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
     that is a tuned version of addBincoSlidingMean:3 forColumnNamed:colName"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    | outRows valColIdx prevRow firstIndex lastIndex meanColIdx|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
    valColIdx := self indexOfColumnNamed:colName.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    outRows := OrderedCollection new.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    prevRow := nil.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    firstIndex := 1. lastIndex := rowData size.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    rowData := rowData collectWithIndex:[:row :idx|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
        |slidingSum|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
        ((idx > firstIndex) and:[idx < lastIndex]) ifTrue:[
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
            slidingSum := (
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
                               ((rowData at:idx-1) at:valColIdx)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
                             + (((rowData at:idx) at:valColIdx)*2)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
                             + ((rowData at:idx+1) at:valColIdx)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
                          ) / 4.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
        ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
        row copyWith:slidingSum.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
    meanColIdx := columnNames size+1.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    (rowData at:firstIndex) at:meanColIdx put:((rowData at:firstIndex+1) at:meanColIdx).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    (rowData at:lastIndex) at:meanColIdx put:((rowData at:lastIndex-1) at:meanColIdx).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    columnNames := columnNames copyWith:('Sliding_Binco_Mean_of_',colName).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
    ^ self 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
            meanPerYearOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
                addBincoSlidingMean3ForColumnNamed:'Mean_Per_Year_TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
                    tableName:'Feldberg/Schwarzwald';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
                    plot:{ #x -> 'MESS_DATUM' . #y -> { 'Mean_Per_Year_TXK' . 'Sliding_Binco_Mean_of_Mean_Per_Year_TXK' .  }}.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    "Created: / 08-01-2019 / 00:10:16 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
    "Modified (comment): / 09-01-2019 / 12:32:34 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
addBincoSlidingMean:n forColumnNamed:colName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
    "add a column with the sliding binco mean (1/2^n + ... + 1/4 + 1/2 + 1/4 + ... + 1/2^n)"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
    |nH outRows valColIdx prevRow firstIndex lastIndex meanColIdx wAll|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
    self assert:(n odd).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    nH := n // 2.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    valColIdx := self indexOfColumnNamed:colName.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
    outRows := OrderedCollection new.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
    prevRow := nil.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
    firstIndex := 1+nH. lastIndex := rowData size-nH.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
    wAll := 0.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
    1 to:nH do:[:delta |
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
        wAll := wAll + (1 / (2 raisedTo:delta)).    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
        wAll := wAll + (1 / (2 raisedTo:delta)).    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    wAll := wAll + 1.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
    rowData := rowData collectWithIndex:[:row :idx|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
        |slidingSum|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
        ((idx >= firstIndex) and:[idx <= lastIndex]) ifTrue:[
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
            slidingSum := 0.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
            "/ ... /8 /4 /2 /1 /2 /4 /8 ...
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
            1 to:nH do:[:delta |
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
                slidingSum := slidingSum + (((rowData at:idx-delta) at:valColIdx) / (2 raisedTo:delta)).    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
                slidingSum := slidingSum + (((rowData at:idx+delta) at:valColIdx) / (2 raisedTo:delta)).    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
            ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
            slidingSum := slidingSum + ((rowData at:idx) at:valColIdx).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
            slidingSum := slidingSum / wAll.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
        ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
        row copyWith:slidingSum.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    meanColIdx := columnNames size+1.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
    1 to:nH do:[:delta |
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
        (rowData at:0+delta) at:meanColIdx put:((rowData at:nH+1) at:meanColIdx)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
    1 to:nH do:[:delta |
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
        (rowData at:rowData size+1-delta) at:meanColIdx put:((rowData at:rowData size-nH-1) at:meanColIdx)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
    columnNames := columnNames copyWith:('Sliding_Binco_Mean_of_',colName).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
    ^ self 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
            meanPerYearOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
                addBincoSlidingMean:5 forColumnNamed:'Mean_Per_Year_TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
                    tableName:'Feldberg/Schwarzwald';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
                    plot:{ #x -> 'MESS_DATUM' . 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
                           #y -> { 'Mean_Per_Year_TXK' . 'Sliding_Binco_Mean_of_Mean_Per_Year_TXK' .  }}.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
    "Created: / 07-01-2019 / 15:37:16 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
    "Modified (comment): / 09-01-2019 / 12:22:31 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
addSlidingMean:n forColumnNamed:colName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
    "add a column with the sliding mean.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
     The sliding mean looks meaner, but may introduce lag (phase shift),
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
     which binco avoids."
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
    |slidingValues slidingSum outRows valColIdx prevYear sum countDaysPerYear|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
    valColIdx := self indexOfColumnNamed:colName.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
    "/ take the the first n values as initial sliding mean
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
    slidingValues := (1 to:n) collect:[:rowIdx | (rowData at:rowIdx) at:valColIdx] as:OrderedCollection.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
    slidingSum := slidingValues sum.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
    outRows := OrderedCollection new.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
    prevYear := nil.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
    sum := countDaysPerYear := 0.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
    rowData := rowData collect:[:row |
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
        | rowsDate rowsYear val|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
        slidingSum := slidingSum - slidingValues first.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
        slidingValues removeFirst.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
        slidingValues add:(row at:valColIdx).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
        slidingSum := slidingSum + slidingValues last.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
        row copyWith:(slidingSum / n).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
    columnNames := columnNames copyWith:('Sliding_Mean_of_',colName).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    ^ self 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
            meanPerYearOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
                addSlidingMean:11 forColumnNamed:'Mean_Per_Year_TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
                    tableName:'Feldberg/Schwarzwald';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
                    plot:{ #x -> 'MESS_DATUM' . #y -> { 'Mean_Per_Year_TXK' . 'Sliding_Mean_of_Mean_Per_Year_TXK' .  }}.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
    "Created: / 06-01-2019 / 20:05:42 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
    "Modified (comment): / 09-01-2019 / 12:33:16 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
extractRowsWhere:filterBlock
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
    "return a new table containing only rows for which filterBlock evaluates to true"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
    |outRows|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
    outRows := rowData select:filterBlock.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
    ^ self class 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
        rows:outRows columnNames:columnNames
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
            meanPerMonthOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
                extractRowsWhere:[:row | (row at:1) startsWith:'1945'])
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
            meanPerMonthOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
                extractRowsWhere:[:row | ((row at:1) from:5 to:6) = '01'])
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
            meanPerMonthOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
                extractMonth:8)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
            meanPerMonthOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
                extractMonth:9)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
            meanPerMonthOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
                extractMonth:10)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19530101_20171231_04931.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
            meanPerMonthOfColumnNamed:'TXK')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
                extractMonth:10)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
                    tableNameSuffix:'-Echterdingen';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
    "Created: / 09-01-2019 / 12:35:44 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
!TableData methodsFor:'analysis - DWD'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   396
dwd_extractMonth:monthIndex
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    "return a new table containing only rows for that month.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
     This is specific to DWD data"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
    
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   400
    ^ self dwd_extractMonth:monthIndex columnName:'MESS_DATUM' format:'%4y%2m%2d'
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   405
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   406
                dwd_extractMonth:1 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   411
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   412
                dwd_extractMonth:2 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   417
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   418
                dwd_extractMonth:8 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   423
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   424
                dwd_extractMonth:9 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   429
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   430
                dwd_extractMonth:10 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19530101_20171231_04931.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   435
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   436
                dwd_extractMonth:10 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
                    tableNameSuffix:'-Echterdingen';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
    "Created: / 06-01-2019 / 19:00:52 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
    "Modified (comment): / 09-01-2019 / 18:30:09 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   448
dwd_extractMonth:monthIndex columnName:monthColumnName
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
    "return a new table containing only rows for that month.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
     This is specific to DWD data"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
    
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   452
    ^ self dwd_extractMonth:monthIndex columnName:monthColumnName format:'%4y%2m%2d'
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   457
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   458
                dwd_extractMonth:1 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   463
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   464
                dwd_extractMonth:2 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   469
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   470
                dwd_extractMonth:8 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   475
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   476
                dwd_extractMonth:9 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   481
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   482
                dwd_extractMonth:10 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
     (((self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19530101_20171231_04931.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   487
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   488
                dwd_extractMonth:10 columnName:'MESS_DATUM' format:'%4y%2m')
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
                    tableNameSuffix:'-Echterdingen';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
                    plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    "Created: / 09-01-2019 / 14:42:05 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
    "Modified (comment): / 09-01-2019 / 18:31:31 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   500
dwd_extractMonth:monthIndex columnName:monthColumnName format:dateFormat
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   501
    "return a new table containing only rows for that month.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   502
     This is specific to DWD data"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   503
    
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   504
    |dateColIdx|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   505
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   506
    dateColIdx := self indexOfColumnNamed:monthColumnName.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   507
    ^ (self 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   508
        extractRowsWhere:[:row | 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   509
            | rowsDate rowsYearAndMonth val|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   510
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   511
            rowsDate := Date readFrom:(row at:dateColIdx) format:dateFormat.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   512
            rowsDate month = monthIndex
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   513
        ])
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   514
        tableName:(Date nameOfMonth:monthIndex),' Mean'
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   515
    
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   516
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   517
     (((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   518
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   519
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   520
                dwd_extractMonth:1 columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   521
                    plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   522
        
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   523
     (((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   524
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   525
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   526
                dwd_extractMonth:2 columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   527
                    plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   528
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   529
     (((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   530
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   531
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   532
                dwd_extractMonth:8 columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   533
                    plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   534
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   535
     (((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   536
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   537
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   538
                dwd_extractMonth:9 columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   539
                    plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   540
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   541
     (((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   542
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   543
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   544
                dwd_extractMonth:10 columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   545
                    plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   546
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   547
     (((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   548
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19530101_20171231_04931.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   549
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   550
                dwd_extractMonth:10 columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   551
                    tableNameSuffix:'-Echterdingen';
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   552
                    plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   553
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   554
     (((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   555
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19530101_20171231_04931.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   556
            dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   557
                dwd_extractMonth:3 columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   558
                    tableNameSuffix:'-Echterdingen';
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   559
                    plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   560
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   561
     |table|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   562
     table := (self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   563
            readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19530101_20171231_04931.txt').
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   564
     1 to:12 do:[:month |        
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   565
         ((table
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   566
                dwd_meanPerMonthOfColumnNamed:'TXK')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   567
                    dwd_extractMonth:month columnName:'MESS_DATUM' format:'%4y%2m')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   568
                        tableNameSuffix:'-Echterdingen';
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   569
                        plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   570
     ]
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   571
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   572
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   573
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   574
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   575
    "Created: / 09-01-2019 / 18:27:28 / Claus Gittinger"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   576
!
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   577
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   578
dwd_extractMonth:month day:day
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
    "return a new table containing only rows for that day in month"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   581
    ^ self dwd_extractMonth:month day:day columnName:'MESS_DATUM' format:'%4y%2m%2d'
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
     ((self fromFile:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   585
        dwd_extractMonth:1 day:1)
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   586
            tableName:'1st Januar, Feldberg';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
            plot:{ #x -> 'MESS_DATUM' . #y -> { 'TXK' . 'TNK' }}
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
    "Created: / 06-01-2019 / 13:15:46 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
    "Modified (comment): / 10-01-2019 / 16:20:48 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   594
!
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   595
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   596
dwd_extractMonth:month day:day columnName:monthColumnName format:dateFormat
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   597
    "return a new table containing only rows for that day in month"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   598
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   599
    |outRows dateColIdx|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   600
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   601
    dateColIdx := self indexOfColumnNamed:monthColumnName.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   602
    outRows := rowData select:[:row |
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   603
        |rowsDate|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   604
        
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   605
        rowsDate := Date readFrom:(row at:dateColIdx) format:dateFormat.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   606
        (rowsDate month = month) and:[rowsDate day = day].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   607
    ].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   608
    ^ self class rows:outRows columnNames:columnNames
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   609
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   610
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   611
     ((self fromFile:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   612
        dwd_extractMonth:1 day:1 columnName:'MESS_DATUM' format:'%4y%2m%2d')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   613
            plot:{ #x -> 'MESS_DATUM' . #y -> { 'TXK' . 'TNK' }}
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   614
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   615
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   616
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   617
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   618
    "Created: / 10-01-2019 / 16:14:29 / Claus Gittinger"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   619
!
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   620
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   621
dwd_meanPerMonthOfColumnNamed:colName
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   622
    "return a new table containing the arithmetic mean per month of a column"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   623
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   624
    |outRows valColIdx dateColIdx prevYearAndMonth sum countDaysPerMonth|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   625
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   626
    dateColIdx := self indexOfColumnNamed:'MESS_DATUM'.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   627
    valColIdx := self indexOfColumnNamed:colName.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   628
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   629
    outRows := OrderedCollection new.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   630
    prevYearAndMonth := nil.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   631
    sum := countDaysPerMonth := 0.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   632
    rowData do:[:row |
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   633
        | rowsDate rowsYearAndMonth val|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   634
        
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   635
        rowsDate := row at:dateColIdx.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   636
        "/ yyyymmdd
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   637
        rowsYearAndMonth := rowsDate copyTo:6.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   638
        prevYearAndMonth isNil ifTrue:[
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   639
            prevYearAndMonth := rowsYearAndMonth.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   640
            sum := countDaysPerMonth := 0.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   641
        ].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   642
        (rowsYearAndMonth = prevYearAndMonth) ifTrue:[
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   643
            val := Number readFrom:(row at:valColIdx).
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   644
            sum := sum + val.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   645
            countDaysPerMonth := countDaysPerMonth + 1.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   646
        ] ifFalse:[
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   647
            outRows add:{ prevYearAndMonth . (sum / countDaysPerMonth) }.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   648
            sum := countDaysPerMonth := 0.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   649
            prevYearAndMonth := rowsYearAndMonth.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   650
        ].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   651
    ].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   652
    ^ self class 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   653
        rows:outRows columnNames:{ 'MESS_DATUM' . 'Mean per month of ',colName }
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   654
        tableName:('Mean Per Month of ',colName)
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   655
    
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   656
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   657
     ((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   658
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   659
            dwd_meanPerMonthOfColumnNamed:'TXK')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   660
                plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   661
        
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   662
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   663
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   664
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   665
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   666
    "Created: / 06-01-2019 / 19:06:36 / Claus Gittinger"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   667
    "Modified (comment): / 09-01-2019 / 12:24:34 / Claus Gittinger"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   668
!
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   669
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   670
dwd_meanPerYearOfColumnNamed:colName
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   671
    "return a new table containing the arithmetic mean per year of a column"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   672
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   673
    |outRows valColIdx dateColIdx prevYear sum countDaysPerYear|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   674
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   675
    dateColIdx := self indexOfColumnNamed:'MESS_DATUM'.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   676
    valColIdx := self indexOfColumnNamed:colName.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   677
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   678
    outRows := OrderedCollection new.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   679
    prevYear := nil.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   680
    sum := countDaysPerYear := 0.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   681
    rowData do:[:row |
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   682
        | rowsDate rowsYear val|
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   683
        
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   684
        rowsDate := row at:dateColIdx.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   685
        "/ yyyymmdd
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   686
        rowsYear := rowsDate copyTo:4.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   687
        prevYear isNil ifTrue:[
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   688
            prevYear := rowsYear.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   689
            sum := countDaysPerYear := 0.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   690
        ].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   691
        (rowsYear = prevYear) ifTrue:[
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   692
            val := Number readFrom:(row at:valColIdx).
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   693
            sum := sum + val.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   694
            countDaysPerYear := countDaysPerYear + 1.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   695
        ] ifFalse:[
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   696
            outRows add:{ prevYear . (sum / countDaysPerYear) }.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   697
            sum := countDaysPerYear := 0.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   698
            prevYear := rowsYear.
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   699
        ].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   700
    ].
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   701
    ^ self class 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   702
        rows:outRows columnNames:{ 'MESS_DATUM' . 'Mean_Per_Year_',colName }
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   703
        tableName:('Mean Per Year of ',colName)
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   704
    
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   705
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   706
     ((self new 
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   707
        read:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   708
            dwd_meanPerYearOfColumnNamed:'TXK')
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   709
                plot
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   710
        
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   711
    "
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   712
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   713
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   714
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   715
    "Created: / 06-01-2019 / 19:40:34 / Claus Gittinger"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   716
    "Modified: / 06-01-2019 / 22:34:06 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   719
!TableData methodsFor:'analysis - masie'!
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   720
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   721
masie_meanPerMonthOfColumnNamed:colName
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   722
    "return a new table containing the arithmetic mean per month of a column
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   723
     of masie data"
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   724
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   725
    |outRows valColIdx dateColIdx prevMonth prevYearAndMonth sum countDaysPerMonth|
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   726
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   727
    dateColIdx := self indexOfColumnNamed:'yyyyddd'.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   728
    valColIdx := self indexOfColumnNamed:colName.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   729
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   730
    outRows := OrderedCollection new.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   731
    prevMonth := nil.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   732
    sum := countDaysPerMonth := 0.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   733
    rowData do:[:row |
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   734
        | date rowsDate rowsYear month rowsDay yearAndMonth rowsYearAndDay val |
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   735
        
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   736
        rowsDate := row at:dateColIdx.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   737
        "/ yyyyddd
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   738
        rowsYear := Integer readFrom:(rowsDate copyTo:4).
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   739
        rowsDay := Integer readFrom:(rowsDate copyFrom:5).
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   740
        date := Date newDay:rowsDay year:rowsYear.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   741
        month := date month.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   742
        yearAndMonth := '%4d%02d' printfWith:date year with:date month.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   743
        prevMonth isNil ifTrue:[
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   744
            prevMonth := month.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   745
            sum := countDaysPerMonth := 0.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   746
        ].
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   747
        (month = prevMonth) ifTrue:[
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   748
            val := Number readFrom:(row at:valColIdx).
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   749
            sum := sum + val.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   750
            countDaysPerMonth := countDaysPerMonth + 1.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   751
        ] ifFalse:[
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   752
            outRows add:{ prevYearAndMonth . (sum / countDaysPerMonth) }.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   753
            sum := countDaysPerMonth := 0.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   754
            prevYearAndMonth := yearAndMonth.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   755
            prevMonth := month.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   756
        ].
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   757
    ].
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   758
    ^ self class 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   759
        rows:outRows columnNames:{ 'YearAndMonth' . 'Mean per month of ',colName }
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   760
        tableName:('Mean Per Month of ',colName)
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   761
    
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   762
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   763
     ((self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   764
        readCSV:'/Users/exept/Downloads/masie_4km_allyears_extent_sqkm.csv' separator:$, skip:1)
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   765
            masie_meanPerMonthOfColumnNamed:'(0) Northern_Hemisphere')
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   766
                plot
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   767
        
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   768
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   769
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   770
    "Created: / 06-01-2019 / 19:06:36 / Claus Gittinger"
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   771
    "Modified (comment): / 09-01-2019 / 12:24:34 / Claus Gittinger"
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   772
! !
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   773
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
!TableData methodsFor:'helpers'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
indexOfColumnNamed:name
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   777
    "find a column index by name"
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   778
    
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
    ^ columnNames indexOf:name ifAbsent:[self error:'no such column'].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
        read:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
        indexOfColumnNamed:'MESS_DATUM'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
    "Created: / 06-01-2019 / 13:20:47 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   790
    "Modified (comment): / 30-05-2019 / 11:33:23 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
!TableData methodsFor:'instance creation'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
rows:rowDataArg columnNames:columnNamesArg
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
    rowData := rowDataArg.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
    columnNames := columnNamesArg.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
    "Created: / 06-01-2019 / 13:26:01 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
rows:rowDataArg columnNames:columnNamesArg tableName:tableNameArg
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
    rowData := rowDataArg.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
    columnNames := columnNamesArg.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
    tableName := tableNameArg.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
    "Created: / 06-01-2019 / 19:25:10 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
!TableData methodsFor:'plotting'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
plot
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
    self plot:nil
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
     |data tmax|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
     
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
     data := self fromFile:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
     tmax := data withColumnsNamed:#('MESS_DATUM' 'TXK' 'TNK').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
     tmax plot:{ #x -> 'MESS_DATUM' . #y -> { 'TXK' 'TNK' }} .
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
    "Created: / 06-01-2019 / 18:47:27 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
    "Modified: / 06-01-2019 / 21:32:22 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
plot:optionalSpec
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
    |tmpFile|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
    [
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
        tmpFile := Filename newTemporary.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
        tmpFile writingFileDo:[:s |
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
            self writeCSVToStream:s.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
        ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
        "/ FileBrowserV2 openOn:tmpFile.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
        self plot:optionalSpec file:tmpFile.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
    ] ensure:[
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
        tmpFile delete
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
     |data tmax|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   843
     
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
     data := self fromFile:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
     tmax := data withColumnsNamed:#('MESS_DATUM' 'TXK' 'TNK').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   846
     tmax plot:{ #x -> 'MESS_DATUM' . #y -> { 'TXK' 'TNK' }} .
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    "Created: / 06-01-2019 / 21:32:09 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
    "Modified: / 09-01-2019 / 18:40:16 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
plot:optionalSpec file:fileName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
    |script scriptFile outFile width height spec xCol yCols|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
    scriptFile := Filename newTemporary .
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
    outFile := '/tmp/plot3.png'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
    outFile asFilename contents:''.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
    width := 1200.
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   861
    height := 800.
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
    optionalSpec notNil ifTrue:[
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
        spec := optionalSpec isDictionary 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
                    ifTrue:[optionalSpec] 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
                    ifFalse:[Dictionary withAssociations:optionalSpec].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
        yCols := spec at:#y.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
        xCol := spec at:#x.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
        script := '
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
png(filename="%1", height=%3, width=%2)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
Data <- read.csv(file="%4", header=TRUE, sep=";")
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
',xCol,' <- Data$',xCol,'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
',((yCols collect:[:col | col,' <- Data$',col]) asStringWith:Character cr),
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
"/'plot(',xCol,', ' 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
"/       ,((yCols collect:[:col | col,', ']) asStringWith:''),
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
"/' type="l", main = "%5")'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   879
',('plot(%1, %2, type="b", col=2, main = "%%5")' bindWith:xCol with:yCols first),'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   880
',((yCols from:2 collect:[:ycol | 'lines(%1, %2, type="l", col=3)' bindWith:xCol with:ycol]) asStringWith:Character cr)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
,'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
# dev.off()
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
            bindWith:outFile 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
            with:width 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
            with:height
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
            with:fileName asFilename pathName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
            with:(tableName ? '').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
        "/ self halt.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
    ] ifFalse:[        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
        script := '
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   892
# library(ggplot2)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
# library(ggfortify)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   894
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
png(filename="%1", height=%3, width=%2)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
Data <- read.csv(file="%4", header=TRUE, sep=";")
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
# theme_set(theme_classic())
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
# Plot 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
# autoplot(Data) + 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
#   labs(title="Data") + 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
#   theme(plot.title = element_text(hjust=0.1))
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
plot(Data, type="l", main = "%5")
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
# plot(Data, cex = .4)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
dev.off()
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
            bindWith:outFile 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
            with:width 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
            with:height
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
            with:fileName asFilename pathName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
            with:(tableName ? '').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
    scriptFile contents:script.        
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
    OSProcess new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
        command:('r --silent --vanilla --slave -f %1' bindWith:scriptFile);
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
        execute.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   920
    "/ self halt.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
    "/ outFile asFilename exists.
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   922
    ((Smalltalk classNamed:#Image) fromFile:outFile asFilename) inspect.
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
     |data tmax|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
     
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
     data := self fromFile:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   928
     tmax := data withColumnsNamed:#('MESS_DATUM' 'TXK').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
     tmax tableName:'Feldberg'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
     tmax plot:{ #x -> 'MESS_DATUM' . #y -> { 'TXK' . 'TNK' }}.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
    "
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   932
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   933
     |data tmax|
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   934
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   935
     data := self fromFile:'/Users/exept/Desktop/klima/monatswerte_KL_01050_19240101_20181231_hist/produkt_klima_monat_19240101_20181231_01050.txt'.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   936
     tmax := data withColumnsNamed:#('MESS_DATUM_BEGINN' 'MO_TT').
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   937
     tmax tableName:'Feldberg'.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   938
     tmax plot:{ #x -> 'MESS_DATUM_BEGINN' . #y -> { 'MO_TT'  }}.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
   939
    "
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   940
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   941
    "Created: / 06-01-2019 / 21:32:43 / Claus Gittinger"
4971
0bfb49cbcd3d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4789
diff changeset
   942
    "Modified: / 30-05-2019 / 11:28:42 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   943
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
plotFile:fileName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
    self plot:nil file:fileName
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
     |data tmax|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
     
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
     data := self fromFile:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
     tmax := data withColumnsNamed:#('MESS_DATUM' 'TXK').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
     tmax tableName:'Test'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
     tmax plot.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
    "Created: / 06-01-2019 / 15:59:47 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
    "Modified: / 06-01-2019 / 21:32:59 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
!TableData methodsFor:'processing'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
removeColumn:index
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   964
    "destructively remove a column"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   966
    columnNames := columnNames copyWithoutIndex:index.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   967
    rowData := rowData collect:[:row | row copyWithoutIndex:index].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   968
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   972
        removeColumn:1;
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   973
        inspect.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   974
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   975
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   976
    "Created: / 06-01-2019 / 13:05:41 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   977
    "Modified (comment): / 09-01-2019 / 12:13:50 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   979
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   980
removeColumnNamed:name
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   981
    "destructively remove a column"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
    self removeColumn:(self indexOfColumnNamed:name)
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   986
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   987
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
        removeColumnNamed:'STATIONS_ID';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
        removeColumnNamed:'QN_3';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
        removeColumnNamed:'FX';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   991
        removeColumnNamed:'FM';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   992
        removeColumnNamed:'RSK';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
        removeColumnNamed:'RSKF';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
        removeColumnNamed:'SDK';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   995
        removeColumnNamed:'SHK_TAG';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
        removeColumnNamed:'NM';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   997
        removeColumnNamed:'VPM';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   998
        removeColumnNamed:'PM';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   999
        removeColumnNamed:'TMK';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1000
        removeColumnNamed:'UPM';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
        removeColumnNamed:'eor';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
        inspect.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1004
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
    "/ StringCollection('MESS_DATUM' 'QN_3' 'FX' 'FM' 'QN_4' 'RSK' 'RSKF' 'SDK' 'SHK_TAG' 'NM' 'VPM' 'PM' 'TMK' 'UPM' 'TXK' 'TNK' 'TGK' 'eor')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1006
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1007
    "Created: / 06-01-2019 / 13:06:50 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1008
    "Modified (comment): / 09-01-2019 / 12:13:53 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1009
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1010
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1011
withColumns:indexCollection
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1012
    "return a new TableData instance, containing only the given columns"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1013
    
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1014
    |remainingNames|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1015
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1016
    remainingNames := indexCollection collect:[:colIdx | columnNames at:colIdx] as:Array.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1017
    ^ self class
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1018
        rows:(rowData collect:[:row | 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1019
                indexCollection collect:[:colIdx | row at:colIdx] as:Array
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1020
                ])
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1021
        columnNames:remainingNames.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1022
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
     (self fromFile:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
        withColumns:#(1 2 3).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
    "Created: / 06-01-2019 / 14:35:11 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1029
    "Modified (comment): / 09-01-2019 / 12:13:57 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1030
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1031
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1032
withColumnsNamed:nameCollection
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1033
    "return a new TableData instance, containing only the given columns"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1034
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1035
    ^ self withColumns:(nameCollection collect:[:nm |self indexOfColumnNamed:nm])
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1036
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1038
     (self fromFile:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1039
        withColumnsNamed:#('MESS_DATUM' 'TXK').
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1041
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1042
    "Created: / 06-01-2019 / 14:36:16 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1043
    "Modified (comment): / 09-01-2019 / 12:13:45 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1044
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1046
withoutColumn:index
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1047
    "return a new TableData instance, without the given columns"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1048
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1049
    ^ self class
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1050
        rows:(rowData collect:[:row | row copyWithoutIndex:index])
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1051
        columnNames:(columnNames copyWithoutIndex:index).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1052
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1053
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1054
     self new 
4789
4daaaab89349 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1055
        readCSV:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1056
        withoutColumn:1.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1057
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1058
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1059
    "Created: / 06-01-2019 / 13:27:11 / Claus Gittinger"
4789
4daaaab89349 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4781
diff changeset
  1060
    "Modified (comment): / 10-01-2019 / 16:25:56 / Claus Gittinger"
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1061
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1062
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1063
withoutColumns:indexCollection
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1064
    "return a new TableData instance, without the given columns"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1065
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
    |remainingColIndices remainingNames|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1068
    remainingColIndices := (1 to:columnNames size) asNewOrderedCollection removeAll:indexCollection; yourself.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1069
    remainingNames := remainingColIndices collect:[:colIdx | columnNames at:colIdx] as:Array.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
    ^ self class
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
        rows:(rowData collect:[:row | 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1072
                remainingColIndices collect:[:colIdx | row at:colIdx] as:Array
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1073
                ])
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1074
        columnNames:remainingNames.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1075
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1076
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1077
     (self fromFile:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt')
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1078
        withoutColumns:#(1 2 3).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1079
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1080
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1081
    "Created: / 06-01-2019 / 14:32:08 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
    "Modified (comment): / 09-01-2019 / 12:14:29 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1084
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1085
!TableData methodsFor:'reading'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1086
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1087
readCSV:filename
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1088
    ^ self readCSV:filename separator:$; skip:0
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1089
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1090
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1092
        readCSV:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
        inspect.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1094
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1095
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1096
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1097
     self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1098
        readCSV:'/Users/exept/Downloads/masie_4km_allyears_extent_sqkm.csv';
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1099
        inspect.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1100
    "
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1101
    "Created: / 09-01-2019 / 12:07:27 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1102
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1103
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1104
readCSV:filename separator:separatorCharacter
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1105
    ^ self readCSV:filename separator:separatorCharacter skip:0
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1106
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1107
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1108
     self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1109
        readCSV:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1110
        inspect.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1111
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1112
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1113
    "Created: / 09-01-2019 / 12:11:11 / Claus Gittinger"
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1114
!
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1115
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1116
readCSV:filename separator:separatorCharacter skip:numLinesToSkip
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1117
    |headLine numCols dataLine ls word row rows|
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1118
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1119
    filename asFilename readingFileDo:[:s |
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1120
        numLinesToSkip timesRepeat:[s nextLine].
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1121
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1122
        rows := OrderedCollection new.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1123
        headLine := s nextLine.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1124
        numCols := (headLine occurrencesOf:separatorCharacter)+1.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1125
        columnNames := (headLine splitBy:separatorCharacter) collect:#withoutSeparators.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1126
        [s atEnd] whileFalse:[
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1127
            dataLine := s nextLine.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1128
            ls := dataLine readStream.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1129
            row := OrderedCollection new:numCols.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1130
            [ls atEnd] whileFalse:[
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1131
                ls skipSeparators.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1132
                word := (ls upTo:separatorCharacter) withoutSeparators.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1133
                row add:word.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1134
            ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1135
            rows add:(row asArray).
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
        ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
    ].
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
    rowData := rows.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1140
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1141
     self new 
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1142
        readCSV:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1143
        inspect.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1144
    "
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1145
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1146
    "Created: / 09-01-2019 / 12:11:11 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1147
!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1149
readCSV:filename skip:numLinesToSkip
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1150
    ^ self readCSV:filename separator:$; skip:numLinesToSkip
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1151
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1152
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1153
     self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1154
        readCSV:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt';
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1155
        inspect.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1156
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1157
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1158
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1159
     self new 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1160
        readCSV:'/Users/exept/Downloads/masie_4km_allyears_extent_sqkm.csv' skip:1;
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1161
        inspect.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1162
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1163
    "Created: / 09-01-2019 / 12:07:27 / Claus Gittinger"
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1164
!
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1165
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1166
readDemoCSV
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1167
    self readCSV:'/Users/cg/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt'.
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1168
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1169
    "Created: / 09-01-2019 / 12:07:52 / Claus Gittinger"
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
5232
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1172
!TableData methodsFor:'writing'!
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1173
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1174
writeCSVToStream:aStream
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1175
    "save myself as CSV onto a stream"
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1176
    
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1177
    columnNames 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1178
        do:[:nm | 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1179
            (nm includes:$;) ifTrue:[
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1180
                aStream nextPut:$"; nextPutAll:nm; nextPut:$".
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1181
            ] ifFalse:[
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1182
                aStream nextPutAll:nm
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1183
            ]]
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1184
        separatedBy:[aStream nextPut:$;].
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1185
    aStream cr.        
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1186
    rowData do:[:row |
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1187
        row
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1188
            do:[:col | 
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1189
                |s|
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1190
                s := col printString.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1191
                (s includes:$;) ifTrue:[
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1192
                    aStream nextPut:$"; nextPutAll:s; nextPut:$".
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1193
                ] ifFalse:[
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1194
                    aStream nextPutAll:s
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1195
                ]
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1196
            ]
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1197
            separatedBy:[aStream nextPut:$;].
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1198
        aStream cr.        
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1199
    ].
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1200
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1201
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1202
     |data tmax|
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1203
     
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1204
     data := self fromFile:'~/Documents/klima/data/DWD/daily/kl/historical/produkt_klima_tag_19450101_20171231_01346.txt'.
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1205
     tmax := data withColumnsNamed:#('MESS_DATUM' 'TXK' 'TNK').
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1206
     String streamContents:[:s | tmax writeCSVToStream:s]
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1207
    "
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1208
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1209
    "Created: / 09-01-2019 / 17:48:25 / Claus Gittinger"
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1210
! !
a99483a7340f #DOCUMENTATION by exept
Claus Gittinger <cg@exept.de>
parents: 4973
diff changeset
  1211
4781
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
!TableData class methodsFor:'documentation'!
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1213
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1214
version_CVS
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
    ^ '$Header$'
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
! !
a4d11bd443dc initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217