1
1
"use strict" ;
2
2
3
- var isInteractive = true ; // could be set to false for non-interactive graphs - useful e.g. for working with the ensembles
3
+ var isInteractive = true ; // true: using plotly.js | false: without plotly.js - useful e.g. for working with the ensembles
4
+ var showConsoleLogs = false ;
4
5
5
6
var basicPlot = isInteractive ? null : require ( "./basic_plot.js" ) ;
6
7
var interactivePlot = isInteractive ? require ( "./interactive_plot.js" ) : null ;
@@ -49,16 +50,20 @@ function getLocalMocks () {
49
50
] ;
50
51
}
51
52
52
- console . log ( "process.env.NODE_ENV='" + process . env . NODE_ENV + "'" ) ;
53
+ function echo ( txt ) {
54
+ if ( showConsoleLogs ) console . log ( txt ) ;
55
+ }
56
+
57
+ echo ( "process.env.NODE_ENV='" + process . env . NODE_ENV + "'" ) ;
53
58
var mocks ;
54
59
switch ( process . env . NODE_ENV ) {
55
60
case "proxy-data" :
56
61
mocks = getLiveMocks ( ) ;
57
- console . log ( "Using grib2 data fetched from Datamart using proxy server!" ) ;
62
+ echo ( "Using grib2 data fetched from Datamart using proxy server!" ) ;
58
63
break ;
59
64
case "local-data" :
60
65
mocks = getLocalMocks ( ) ;
61
- console . log ( "Using local (already downloaded) grib2 data" ) ;
66
+ echo ( "Using local (already downloaded) grib2 data" ) ;
62
67
break ;
63
68
default :
64
69
console . error ( "BAD BUNDLE" ) ;
@@ -99,7 +104,7 @@ var beforeAfter = {
99
104
} ;
100
105
101
106
function go ( link ) {
102
- console . log ( "Loading:'" + link + "'" ) ;
107
+ echo ( "Loading:'" + link + "'" ) ;
103
108
enableLoading ( ) ;
104
109
105
110
link = link . replace ( "https://" , "http://" ) ;
@@ -125,7 +130,7 @@ function go (link) {
125
130
} ) ;
126
131
res . on ( "end" , function ( ) {
127
132
myGrid . parse ( Buffer . concat ( allChunks ) ) ;
128
- console . log ( myGrid ) ;
133
+ echo ( myGrid ) ;
129
134
130
135
if ( isInteractive ) {
131
136
interactivePlot ( myGrid , document . getElementById ( "interactivePlot" ) , beforeAfter ) ;
0 commit comments