Commit ded8189bed1f4bb80d12c514697d3c6f554eab44
Exists in
master
and in
73 other branches
Merge branch 'develop' into amdadev
Showing
2 changed files
with
203 additions
and
207 deletions
Show diff stats
help/ncTimeFormat
@@ -8,7 +8,7 @@ netCDF3<br/> | @@ -8,7 +8,7 @@ netCDF3<br/> | ||
8 | <ul> | 8 | <ul> |
9 | <li> double (seconds from 01/01/1970) | 9 | <li> double (seconds from 01/01/1970) |
10 | <li> string ISO (YYYY-MM-DDTHH:MM:SS.MSK) | 10 | <li> string ISO (YYYY-MM-DDTHH:MM:SS.MSK) |
11 | - <li> string DD Time (YYYYDOYHHMMSSMSK, where DOY = Day-Of-Year -1) | 11 | + <li> string DOY TIME (YYYYDOYHHMMSSMSK, where DOY = Day-Of-Year) |
12 | </ul> | 12 | </ul> |
13 | 13 | ||
14 | 14 |
js/app/models/Download.js
@@ -10,212 +10,208 @@ | @@ -10,212 +10,208 @@ | ||
10 | 10 | ||
11 | 11 | ||
12 | Ext.define('amdaModel.DownloadConfig', { | 12 | Ext.define('amdaModel.DownloadConfig', { |
13 | - singleton: true, | ||
14 | - | ||
15 | - defaultValues : { | ||
16 | - timeformat: 'YYYY-MM-DDThh:mm:ss', | ||
17 | - timeformatTT: 'YYYY-MM-DDThh:mm:ss', | ||
18 | - fileformat: 'ASCII', | ||
19 | - fileformatTT: 'text', | ||
20 | - filecompress: 'tar+gzip', | ||
21 | - filecompressTT: 'tar+gzip', | ||
22 | - filestructure: '2' | ||
23 | - }, | ||
24 | - | ||
25 | - timeformatData: [ | ||
26 | - ['YYYY-MM-DDThh:mm:ss', 'YYYY-MM-DDThh:mm:ss.ms', 'ISO format with msecs'], | ||
27 | - ['DD Time', 'YYYYDOYhhmmssms', 'Day-Of-Year, 1 Jan : DOY = 0'], | ||
28 | - ['Timestamp', 'Seconds from 1970', 'Total of seconds from the Unix Epoch on January 1st, 1970 at UTC.'], | ||
29 | - ['YYYY MM DD hh mm ss', 'YYYY MM DD hh mm ss ms', 'date with spaces'], | ||
30 | - ['Timestamp-with-milliseconds', 'Seconds from 1970 with ms', 'Total of seconds from the Unix Epoch with milliseconds.'] | ||
31 | - ], | ||
32 | - fileformatData: [ | ||
33 | - ['ASCII', 'ASCII'], | ||
34 | - ['vot', 'VOTable'], | ||
35 | - ['cdf', 'CDF'], | ||
36 | - ['json', 'JSON'] | ||
37 | - ], | ||
38 | - fileformatTTData: [ | ||
39 | - ['text', 'plain text'], | ||
40 | - ['vot', 'VOTable'], | ||
41 | - ['space', 'HPEvent'] | ||
42 | - ], | ||
43 | - filecompressData: [ | ||
44 | - ['zip', 'zip'], | ||
45 | - ['tar+gzip', 'tar+gzip'] | ||
46 | - ], | ||
47 | - filecompressTTData: [ | ||
48 | - ['zip', 'zip'], | ||
49 | - ['tar+gzip', 'tar+gzip'], | ||
50 | - ['none', 'none'] | ||
51 | - ], | ||
52 | - filestructureData: [ | ||
53 | - ['0', 'All In One File'], | ||
54 | - ['1', 'One File Per Time Interval'], | ||
55 | - ['2', 'One File Per Param/Interval'] | ||
56 | - ] | 13 | + singleton: true, |
14 | + | ||
15 | + defaultValues: { | ||
16 | + timeformat: 'YYYY-MM-DDThh:mm:ss', | ||
17 | + timeformatTT: 'YYYY-MM-DDThh:mm:ss', | ||
18 | + fileformat: 'ASCII', | ||
19 | + fileformatTT: 'text', | ||
20 | + filecompress: 'tar+gzip', | ||
21 | + filecompressTT: 'tar+gzip', | ||
22 | + filestructure: '2' | ||
23 | + }, | ||
24 | + | ||
25 | + timeformatData: [ | ||
26 | + ['YYYY-MM-DDThh:mm:ss', 'YYYY-MM-DDThh:mm:ss.ms', 'ISO format with msecs'], | ||
27 | + ['DOY TIME', 'YYYYDOYhhmmssms', 'Day-Of-Year, 1 Jan => DOY = 1'], | ||
28 | + ['Timestamp', 'Seconds from 1970', 'Total of seconds from the Unix Epoch on January 1st, 1970 at UTC.'], | ||
29 | + ['YYYY MM DD hh mm ss', 'YYYY MM DD hh mm ss ms', 'date with spaces'], | ||
30 | + ['Timestamp-with-milliseconds', 'Seconds from 1970 with ms', 'Total of seconds from the Unix Epoch with milliseconds.'] | ||
31 | + ], | ||
32 | + fileformatData: [ | ||
33 | + ['ASCII', 'ASCII'], | ||
34 | + ['vot', 'VOTable'], | ||
35 | + ['cdf', 'CDF'], | ||
36 | + ['json', 'JSON'] | ||
37 | + ], | ||
38 | + fileformatTTData: [ | ||
39 | + ['text', 'plain text'], | ||
40 | + ['vot', 'VOTable'], | ||
41 | + ['space', 'HPEvent'] | ||
42 | + ], | ||
43 | + filecompressData: [ | ||
44 | + ['zip', 'zip'], | ||
45 | + ['tar+gzip', 'tar+gzip'] | ||
46 | + ], | ||
47 | + filecompressTTData: [ | ||
48 | + ['zip', 'zip'], | ||
49 | + ['tar+gzip', 'tar+gzip'], | ||
50 | + ['none', 'none'] | ||
51 | + ], | ||
52 | + filestructureData: [ | ||
53 | + ['0', 'All In One File'], | ||
54 | + ['1', 'One File Per Time Interval'], | ||
55 | + ['2', 'One File Per Param/Interval'] | ||
56 | + ] | ||
57 | }); | 57 | }); |
58 | - | 58 | + |
59 | Ext.define('amdaModel.Download', { | 59 | Ext.define('amdaModel.Download', { |
60 | - extend: 'amdaModel.AmdaTimeObject', | ||
61 | - | ||
62 | - requires: [ | ||
63 | - "amdaModel.DownloadParam" | ||
64 | - ], | ||
65 | - | ||
66 | - fields : [ | ||
67 | - {name: 'type', type: 'string', defaultValue: 'Download'}, | ||
68 | - {name: 'downloadSrc', type: 'string'}, | ||
69 | - {name: 'timeformat', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.timeformat}, | ||
70 | - {name: 'timeformatTT', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.timeformatTT}, | ||
71 | - {name: 'filestructure', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.filestructure}, | ||
72 | - {name: 'refparamSampling', type: 'boolean', defaultValue: false}, | ||
73 | - {name: 'separateInfoFile', type: 'boolean', defaultValue: false}, | ||
74 | - {name: 'sampling', type: 'float', defaultValue: '600'}, | ||
75 | - {name: 'scientificformat', type: 'boolean', defaultValue: true}, | ||
76 | - {name: 'fileprefix', type: 'string'}, | ||
77 | - {name: 'fileformat', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.fileformat}, | ||
78 | - {name: 'fileformatTT', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.fileformatTT}, | ||
79 | - {name: 'compression', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.filecompress}, | ||
80 | - {name: 'compressionTT', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.filecompressTT}, | ||
81 | - {name: 'last_update', type: 'int', defaultValue: 0} | ||
82 | - ], | ||
83 | - | ||
84 | - associations : [ | ||
85 | - { | ||
86 | - type : 'hasMany', | ||
87 | - model : 'amdaModel.DownloadParam', | ||
88 | - name : 'params' | ||
89 | - } | ||
90 | - ], | ||
91 | - | ||
92 | - propertiesToCopy : 'id,name,downloadSrc,refparamSampling,separateInfoFile,sampling,scientificformat,list,timeformat,timeformatTT,filestructure,fileprefix,fileformat,fileformatTT,compression,compressionTT', | ||
93 | - | ||
94 | - constructor: function(){ | ||
95 | - var me = this; | ||
96 | - me.callParent(arguments); | ||
97 | - if ((arguments.length > 0) && arguments[0]) | ||
98 | - { | ||
99 | - if (arguments[0].list) | ||
100 | - me.loadParams(arguments[0].list); | ||
101 | - } | ||
102 | - this.dirty = false; | ||
103 | - }, | ||
104 | - | ||
105 | - loadParams: function(params) | ||
106 | - { | ||
107 | - /* Compatability mode */ | ||
108 | - Ext.each(params, function(param, index) { | ||
109 | - if (param.hasOwnProperty('is-init')) { | ||
110 | - return; | ||
111 | - } | ||
112 | - params[index]['dim1-sum-type'] = param['dim1-is-range'] ? 1 : 0; | ||
113 | - params[index]['dim1-min-value'] = param['dim1-min-range']; | ||
114 | - params[index]['dim1-max-value'] = param['dim1-max-range']; | ||
115 | - params[index]['dim2-sum-type'] = param['dim2-is-range'] ? 1 : 0; | ||
116 | - params[index]['dim2-min-value'] = param['dim2-min-range']; | ||
117 | - params[index]['dim2-max-value'] = param['dim2-max-range']; | ||
118 | - params[index]['is-init'] = true; | ||
119 | - }); | ||
120 | - this.params().loadData(params); | ||
121 | - }, | ||
122 | - | ||
123 | - isDirty : function() { | ||
124 | - if (this.dirty) | ||
125 | - return true; | ||
126 | - | ||
127 | - var d = false; | ||
128 | - | ||
129 | - this.params().each(function (param, index) { | ||
130 | - if (param.dirty) | ||
131 | - d = true; | 60 | + extend: 'amdaModel.AmdaTimeObject', |
61 | + | ||
62 | + requires: [ | ||
63 | + "amdaModel.DownloadParam" | ||
64 | + ], | ||
65 | + | ||
66 | + fields: [ | ||
67 | + { name: 'type', type: 'string', defaultValue: 'Download' }, | ||
68 | + { name: 'downloadSrc', type: 'string' }, | ||
69 | + { name: 'timeformat', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.timeformat }, | ||
70 | + { name: 'timeformatTT', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.timeformatTT }, | ||
71 | + { name: 'filestructure', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.filestructure }, | ||
72 | + { name: 'refparamSampling', type: 'boolean', defaultValue: false }, | ||
73 | + { name: 'separateInfoFile', type: 'boolean', defaultValue: false }, | ||
74 | + { name: 'sampling', type: 'float', defaultValue: '600' }, | ||
75 | + { name: 'scientificformat', type: 'boolean', defaultValue: true }, | ||
76 | + { name: 'fileprefix', type: 'string' }, | ||
77 | + { name: 'fileformat', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.fileformat }, | ||
78 | + { name: 'fileformatTT', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.fileformatTT }, | ||
79 | + { name: 'compression', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.filecompress }, | ||
80 | + { name: 'compressionTT', type: 'string', defaultValue: amdaModel.DownloadConfig.defaultValues.filecompressTT }, | ||
81 | + { name: 'last_update', type: 'int', defaultValue: 0 } | ||
82 | + ], | ||
83 | + | ||
84 | + associations: [{ | ||
85 | + type: 'hasMany', | ||
86 | + model: 'amdaModel.DownloadParam', | ||
87 | + name: 'params' | ||
88 | + }], | ||
89 | + | ||
90 | + propertiesToCopy: 'id,name,downloadSrc,refparamSampling,separateInfoFile,sampling,scientificformat,list,timeformat,timeformatTT,filestructure,fileprefix,fileformat,fileformatTT,compression,compressionTT', | ||
91 | + | ||
92 | + constructor: function() { | ||
93 | + var me = this; | ||
94 | + me.callParent(arguments); | ||
95 | + if ((arguments.length > 0) && arguments[0]) { | ||
96 | + if (arguments[0].list) | ||
97 | + me.loadParams(arguments[0].list); | ||
98 | + } | ||
99 | + this.dirty = false; | ||
100 | + }, | ||
101 | + | ||
102 | + loadParams: function(params) { | ||
103 | + /* Compatability mode */ | ||
104 | + Ext.each(params, function(param, index) { | ||
105 | + if (param.hasOwnProperty('is-init')) { | ||
106 | + return; | ||
107 | + } | ||
108 | + params[index]['dim1-sum-type'] = param['dim1-is-range'] ? 1 : 0; | ||
109 | + params[index]['dim1-min-value'] = param['dim1-min-range']; | ||
110 | + params[index]['dim1-max-value'] = param['dim1-max-range']; | ||
111 | + params[index]['dim2-sum-type'] = param['dim2-is-range'] ? 1 : 0; | ||
112 | + params[index]['dim2-min-value'] = param['dim2-min-range']; | ||
113 | + params[index]['dim2-max-value'] = param['dim2-max-range']; | ||
114 | + params[index]['is-init'] = true; | ||
115 | + }); | ||
116 | + this.params().loadData(params); | ||
117 | + }, | ||
118 | + | ||
119 | + isDirty: function() { | ||
120 | + if (this.dirty) | ||
121 | + return true; | ||
122 | + | ||
123 | + var d = false; | ||
124 | + | ||
125 | + this.params().each(function(param, index) { | ||
126 | + if (param.dirty) | ||
127 | + d = true; | ||
128 | + }); | ||
129 | + return d; | ||
130 | + }, | ||
131 | + | ||
132 | + getJsonValues: function() { | ||
133 | + | ||
134 | + var myValues = new Object(); | ||
135 | + myValues.nodeType = 'download'; //amdaModel.DownloadNode.nodeType; | ||
136 | + myValues.type = this.get('type'); | ||
137 | + myValues.downloadSrc = this.get('downloadSrc'); | ||
138 | + myValues.name = this.get('name'); | ||
139 | + //Data download | ||
140 | + if (myValues.downloadSrc === '0') { // Data download | ||
141 | + myValues.filestructure = this.get('filestructure'); | ||
142 | + myValues.refparamSampling = this.get('refparamSampling'); | ||
143 | + myValues.separateInfoFile = this.get('separateInfoFile'); | ||
144 | + myValues.scientificformat = this.get('scientificformat'); | ||
145 | + myValues.sampling = this.get('sampling'); | ||
146 | + myValues.fileprefix = this.get('fileprefix'); | ||
147 | + | ||
148 | + myValues.timesrc = this.get('timesrc'); | ||
149 | + // if there's at least one timeTable in case of Download data | ||
150 | + if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length) { | ||
151 | + // get complete timeTables collection | ||
152 | + var timeTables = this.get('timeTables'); // init an empty array for timeTables | ||
153 | + myValues.timeTables = []; | ||
154 | + // for each interval record | ||
155 | + Ext.Array.each(timeTables, function(item, index, all) { | ||
156 | + // get Json simplified value | ||
157 | + if (!item.$className) { | ||
158 | + myValues.timeTables[index] = { timeTableName: item.timeTableName, id: item.id }; | ||
159 | + } | ||
160 | + // get Json simplified value | ||
161 | + else { | ||
162 | + myValues.timeTables[index] = item.getJsonValues(); | ||
163 | + } | ||
164 | + }); | ||
165 | + } else { | ||
166 | + myValues.startDate = this.get('startDate'); | ||
167 | + myValues.stopDate = this.get('stopDate'); | ||
168 | + myValues.durationDay = this.get('durationDay'); | ||
169 | + myValues.durationHour = this.get('durationHour'); | ||
170 | + myValues.durationMin = this.get('durationMin'); | ||
171 | + myValues.durationSec = this.get('durationSec'); | ||
172 | + } | ||
173 | + | ||
174 | + // if there's at least one parameter | ||
175 | + myValues.list = [] | ||
176 | + this.params().each(function(param, index) { | ||
177 | + myValues.list[index] = param.getJsonValues(); | ||
132 | }); | 178 | }); |
133 | - return d; | ||
134 | - }, | ||
135 | - | ||
136 | - getJsonValues : function(){ | ||
137 | - | ||
138 | - var myValues = new Object(); | ||
139 | - myValues.nodeType = 'download';//amdaModel.DownloadNode.nodeType; | ||
140 | - myValues.type = this.get('type'); | ||
141 | - myValues.downloadSrc = this.get('downloadSrc'); | ||
142 | - myValues.name = this.get('name'); | ||
143 | - //Data download | ||
144 | - if (myValues.downloadSrc === '0') { // Data download | ||
145 | - myValues.filestructure = this.get('filestructure'); | ||
146 | - myValues.refparamSampling = this.get('refparamSampling'); | ||
147 | - myValues.separateInfoFile = this.get('separateInfoFile'); | ||
148 | - myValues.scientificformat = this.get('scientificformat'); | ||
149 | - myValues.sampling = this.get('sampling'); | ||
150 | - myValues.fileprefix = this.get('fileprefix'); | ||
151 | - | ||
152 | - myValues.timesrc = this.get('timesrc'); | ||
153 | - // if there's at least one timeTable in case of Download data | ||
154 | - if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){ | ||
155 | - // get complete timeTables collection | ||
156 | - var timeTables = this.get('timeTables'); // init an empty array for timeTables | ||
157 | - myValues.timeTables=[]; | ||
158 | - // for each interval record | ||
159 | - Ext.Array.each(timeTables, function(item, index, all){ | ||
160 | - // get Json simplified value | ||
161 | - if (!item.$className) { | ||
162 | - myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id}; | ||
163 | - } | ||
164 | - // get Json simplified value | ||
165 | - else { | ||
166 | - myValues.timeTables[index] = item.getJsonValues(); | ||
167 | - } | ||
168 | - }); | ||
169 | - } else { | ||
170 | - myValues.startDate = this.get('startDate'); | ||
171 | - myValues.stopDate = this.get('stopDate'); | ||
172 | - myValues.durationDay = this.get('durationDay'); | ||
173 | - myValues.durationHour = this.get('durationHour'); | ||
174 | - myValues.durationMin = this.get('durationMin'); | ||
175 | - myValues.durationSec = this.get('durationSec'); | ||
176 | - } | ||
177 | - | ||
178 | - // if there's at least one parameter | ||
179 | - myValues.list = [] | ||
180 | - this.params().each(function (param, index) { | ||
181 | - myValues.list[index] = param.getJsonValues(); | ||
182 | - }); | ||
183 | - myValues.fileformat = this.get('fileformat'); | ||
184 | - myValues.timeformat = this.get('timeformat'); | ||
185 | - myValues.compression = this.get('compression'); | ||
186 | - } | ||
187 | - // TT download | ||
188 | - else if (myValues.downloadSrc === '1') { | ||
189 | - // if there's at least one timeTable | ||
190 | - if (this.get('timeTables') && this.get('timeTables').length) { | ||
191 | - var list = this.get('timeTables'); | ||
192 | - myValues.list=[]; | ||
193 | - | ||
194 | - Ext.each(list, function(item, index){ | ||
195 | - var tt = new Object(); | ||
196 | - tt.name = item.get('name'); | ||
197 | - tt.id = item.get('id'); | ||
198 | - myValues.list[index] = tt; | ||
199 | - }); | ||
200 | - } | ||
201 | - myValues.fileformat = this.get('fileformatTT'); | ||
202 | - myValues.timeformat = this.get('timeformatTT'); | ||
203 | - myValues.compression = this.get('compressionTT'); | ||
204 | - } | ||
205 | - // fits images download | ||
206 | - else { | ||
207 | - myValues.list=[]; | ||
208 | - if (this.get('list') && this.get('list').length) | ||
209 | - Ext.each(this.get('list'), function(item, index){ | ||
210 | - var image = new Object(); | ||
211 | - image.name = item['name']; | ||
212 | - image.url = item['url']; | ||
213 | - myValues.list[index] = image; | ||
214 | - }); | ||
215 | - myValues.compression = this.get('compression'); | ||
216 | - } | ||
217 | - myValues.leaf = true; | ||
218 | - // myValues.nodeType = amdaModel.PlotNode.nodeType; | ||
219 | - return myValues; | ||
220 | - } | ||
221 | -}); | 179 | + myValues.fileformat = this.get('fileformat'); |
180 | + myValues.timeformat = this.get('timeformat'); | ||
181 | + myValues.compression = this.get('compression'); | ||
182 | + } | ||
183 | + // TT download | ||
184 | + else if (myValues.downloadSrc === '1') { | ||
185 | + // if there's at least one timeTable | ||
186 | + if (this.get('timeTables') && this.get('timeTables').length) { | ||
187 | + var list = this.get('timeTables'); | ||
188 | + myValues.list = []; | ||
189 | + | ||
190 | + Ext.each(list, function(item, index) { | ||
191 | + var tt = new Object(); | ||
192 | + tt.name = item.get('name'); | ||
193 | + tt.id = item.get('id'); | ||
194 | + myValues.list[index] = tt; | ||
195 | + }); | ||
196 | + } | ||
197 | + myValues.fileformat = this.get('fileformatTT'); | ||
198 | + myValues.timeformat = this.get('timeformatTT'); | ||
199 | + myValues.compression = this.get('compressionTT'); | ||
200 | + } | ||
201 | + // fits images download | ||
202 | + else { | ||
203 | + myValues.list = []; | ||
204 | + if (this.get('list') && this.get('list').length) | ||
205 | + Ext.each(this.get('list'), function(item, index) { | ||
206 | + var image = new Object(); | ||
207 | + image.name = item['name']; | ||
208 | + image.url = item['url']; | ||
209 | + myValues.list[index] = image; | ||
210 | + }); | ||
211 | + myValues.compression = this.get('compression'); | ||
212 | + } | ||
213 | + myValues.leaf = true; | ||
214 | + // myValues.nodeType = amdaModel.PlotNode.nodeType; | ||
215 | + return myValues; | ||
216 | + } | ||
217 | +}); | ||
222 | \ No newline at end of file | 218 | \ No newline at end of file |