PageSourceSearch

https://climatecharts.net/build/modules/main/config.js

js climatecharts.net collected 2026-10-02 05:03:01 UTC 12,185 bytes, 343 lines download raw bytes

1"use strict";
2
3// ############################################################################
4// MAIN CONFIGURATIONS
5// ############################################################################
6// Defines configuration data for the modules of the program..
7// Tweak the values here without changing the actual source code.
8// ############################################################################
9
10
11var loadConfig = function loadConfig(main) {
12  main.config = {
13
14    // ========================================================================
15    time: {
16      minYear: 1750, // Minimum possible year of climate data
17      maxYear: 2023, // Maximum possible year of climate data
18      periodLength: 30, // Number of years in time period (default: 30)
19      periodEnd: 2023 // Initial end year of the period
20    },
21
22    // ========================================================================
23    map: {
24      container: "map",
25      startPos: [50, 10], // Initial map center [lat, lng]
26      startZoom: 2, // Discrete zoom level [0 .. 12]
27      maxBoundsViscosity: 0.75, // Solidity of the bounds when dragging [0 .. 1]
28      tileLayers: {
29        "ESRI": L.tileLayer( // ESRI Online
30        'https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
31          id: 'ESRI',
32          maxZoom: 20,
33          attribution: 'Tiles © ESRI'
34        }),
35        "OpenStreepMap": L.tileLayer( // OpenStreetMap
36        'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
37          id: 'OSM',
38          maxZoom: 19,
39          attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>'
40        })
41      }
42    },
43
44    // ========================================================================
45    coordinates: {
46      decimalPlaces: 3 // Visualized coordinate precision (lat/lng)
47    },
48
49    // ========================================================================
50    climateCell: // map marker: rectangle
51    {
52      style: {
53        color: '#000099', // stroke and background color
54        weight: 2 // stroke width
55      }
56    },
57
58    // ========================================================================
59    charts: {
60      parentContainer: 'main-container-charts',
61      className: 'chart',
62      referenceURL: 'ClimateCharts.net',
63      positions: // [px]
64      {
65        width: 728, // Reference: full width
66        height: 420, // Reference: initial full height
67        titleTop: 10, // Top margin for title
68        subtitleTop: 35, // Top margin for subtitle
69        mainTop: 65, // Top margin for main (= height of title area)
70        footerTop: 50 // Margin for footer
71      },
72      padding: 10,
73      fontSizes: // [em]
74      {
75        title: 1.5,
76        huge: 1.3,
77        large: 1.2,
78        normal: 1.0,
79        small: 0.9,
80        tiny: 0.75
81      },
82      colors: {
83        temp: d3.rgb(230, 20, 20),
84        prec: d3.rgb(4, 61, 183),
85        arid: d3.rgb(255, 233, 15),
86        humid: d3.rgb(89, 131, 213),
87        perhumid: d3.rgb(4, 61, 183),
88        grid: d3.rgb(211, 211, 211),
89        axes: d3.rgb(255, 255, 255),
90        noData: d3.rgb(70, 71, 73)
91      },
92      tempcolors: {
93        t_range1: d3.rgb(249, 231, 174),
94        t_range2: d3.rgb(234, 196, 134),
95        t_range3: d3.rgb(218, 156, 91),
96        t_range4: d3.rgb(198, 109, 46),
97        t_range5: d3.rgb(171, 56, 22),
98        t_range6: d3.rgb(125, 0, 37)
99      },
100      precipcolors: {
101        p_range1: d3.rgb(215, 244, 207),
102        p_range2: d3.rgb(154, 220, 187),
103        p_range3: d3.rgb(24, 189, 176),
104        p_range4: d3.rgb(0, 149, 175),
105        p_range5: d3.rgb(0, 93, 158),
106        p_range6: d3.rgb(38, 24, 95)
107      },
108      footerOpacity: 0.4,
109      saveOptions: {
110        png: {
111          buttonName: "PNG",
112          fileExtension: ".png",
113          scaleFactor: 3,
114          imageQuality: 0.9,
115          fontDecreaseFactor: 0.85 // To get proper font size for saved image
116        },
117        svg: {
118          buttonName: "SVG",
119          fileExtension: ".svg"
120        }
121      },
122      charts: [
123      // --------------------------------------------------------------------
124      {
125        name: 'climate-chart',
126        widthRatio: 0.75, // [%] of full width for diagram -> rest: table
127        margin: // [px]
128        {
129          left: 30,
130          top: 0,
131          right: 30,
132          bottom: 0
133        },
134        diagramMargin: // [px]
135        {
136          max: 10, // vertical distance from top to max line
137          min: 50 // vertical distance from bottom to min line
138        },
139        style: {
140          tickSize: 5,
141          gridWidth: 1,
142          axesWidth: 2,
143          lineWidth: 1.5, // Lines for prec and temp
144          lineWidthBar: 0,
145          areaOpacity: 0.7, // For the areas between prec/temp lines
146          barOpacity: 0.8, // For the areas between prec/temp lines    
147          availabilityOpacity: 0.9,
148          barWidth: 26
149        },
150        prec: {
151          caption: "Precipitation Sum",
152          unit: "mm",
153          breakValue: 100, // [mm] at which prec scale breaks
154          distBelowBreak: 20, // Humid: distance between two ticks
155          distAboveBreak: 200 // Perhumid: distance between two ticks 
156        },
157        temp: {
158          caption: "Temperature Mean",
159          unit: "°C",
160          dist: 10 // Distance between two ticks
161        },
162        table: {
163          heading: {
164            month: "Month",
165            temp: "Temp",
166            prec: "Precip"
167          },
168          margin: // [px]
169          {
170            top: 12, // Downshift from top line
171            right: 10, // Right margin for right-aligned cell values
172            left: 15 // Right margin for left-aligned cell values
173          },
174          maxHeight: 250 // [px]
175        },
176        captionDist: 20, // [px] distance between caption text fields
177        mouseover: {
178          circleRadius: 4.0, // [px]
179          strokeWidth: 2.0 // [px]
180        },
181        switch: {
182          title: "",
183          // states:     ['Walter-Lieth Chart', 'Bar Chart', 'Step Chart'],
184          states: ['Walter-Lieth Chart', 'Bar Chart'],
185          statesDisplay: ['<i class="fas fa-chart-area" aria-hidden="true"></i>', '<i class="fas fa-chart-bar" aria-hidden="true"></i>', '<i class="fas fa-map" aria-hidden="true"></i>'],
186          activeState: 0
187        },
188        availabilitybar: {
189          // oneMonthPercentage : 3.33,
190          colorInterval: 5,
191          temp: "Missing Temperature Data",
192          prec: "Missing Precipitation Data",
193          avail: "Percentage of Missing Data"
194        },
195        availabilitycolors: {
196          a_range6: d3.rgb(249, 249, 249),
197          a_range5: d3.rgb(218, 218, 218),
198          a_range4: d3.rgb(174, 174, 174),
199          a_range3: d3.rgb(126, 126, 126),
200          a_range2: d3.rgb(76, 76, 76),
201          a_range1: d3.rgb(27, 27, 27)
202          // hardbreak:          d3.rgb(255,0,0)
203        },
204        infoTextNotEnoughData: "There is not enough data available for the selected station to create a climate chart. Please choose a different time period or take a look at the other charts of your selection which you can find in the sidepanel of this chart's container. Detailed information regarding the availability of the data can be found in the "
205      },
206
207      // --------------------------------------------------------------------
208      {
209        name: 'distribution-chart',
210        margin: // [px]
211        {
212          left: 30,
213          top: 30,
214          right: 30,
215          bottom: 0
216        },
217        style: {
218          boxOpacity: 0.7, // For the boxplots
219          axesWidth: 2.0, // [px]
220          gridWidth: 0.5 // [px]
221        },
222        minMaxStretchFactor: 0.1, // How much to stretch min/max values
223        subcharts: [{
224          data: 'temp',
225          title: "Distribution of Temperature [°C]",
226          color: 'rgb(230, 20, 20)',
227          maxRange: [-40, +40]
228        }, {
229          data: 'prec',
230          title: "Distribution of Precipitation [mm]",
231          color: 'rgb(4, 61, 186)',
232          maxRange: [0, +1000]
233        }],
234        switch: {
235          title: "Y-Axis Scaling",
236          states: ['relative', 'fixed'],
237          statesDisplay: ['Relative', 'Fixed'],
238          // statesDisplay: [
239          //   '<img class="switch-icons-img" src="data/img/fine1/yscale-relative.png" />', 
240          //   '<img class="switch-icons-img" src="data/img/fine1/yscale-fixed.png" />',
241          // ],
242          activeState: 0
243        }
244      },
245
246      // --------------------------------------------------------------------
247      {
248        name: 'availability-chart',
249        margin: // [px]
250        {
251          left: 50,
252          top: 50,
253          right: 50,
254          bottom: 0
255        },
256        style: {
257          gridWidth: 1, // Width of stroke of square
258          squareWidth: 26, // Dimension of cell squares
259          rowHeadWidth: 20, // Width of row "heading" (year number)
260          colHeadHeight: 12, // Height of col heading (month / value)
261          titleMargin: 45 // Margin-bottom for title of the chart
262        },
263        headings: {
264          title: "Availability of Climate Data",
265          temp: "Temp",
266          prec: "Prec"
267        },
268        legend: {
269          temp: "Temperature Scale [°C]",
270          prec: "Precipitation Scale [mm]",
271          noData: "No data available"
272        },
273        switch: {
274          title: "Color Scaling",
275          states: ['relative', 'fixed'],
276          statesDisplay: ['Relative', 'Fixed'],
277          activeState: 0
278        }
279      },
280      // --------------------------------------------------------------------
281      {
282        name: 'map-chart',
283        margin: // [px]
284        {
285          left: 30,
286          top: 30,
287          right: 30,
288          bottom: 0
289        }
290      }]
291    },
292
293    // ========================================================================
294    climateData: {
295      decimalPlaces: 1, // Decimal precision for both temp / prec
296      startWithDataset: "CRU Time Series v4.07"
297    },
298
299    // ========================================================================
300    datasetsInfobox: {
301      ref: "Data Reference",
302      metadata: "Metadata",
303      resolution: "Spatial Resolution",
304      time: "Temporal Coverage",
305      station: "Weather Station",
306      coverage: "Data Coverage Rate",
307      gap: "Largest Gap",
308      missingMonths: "Missing Months"
309    },
310
311    // ========================================================================
312    // Weather stations (marker: circle)
313    station: {
314      initRadius: 1, // initial radius of a station [px]
315      scaleFactor: 1.5, // resize factor on map zoom
316      minRadius: 1, // minimum radius that will never be undershot
317      maxRadius: 7, // maximum radius that will never be exceeded
318      style: {
319        default: // leaflet style for deselected weather station
320        {
321          className: 'weatherstation-marker',
322          stroke: true,
323          opacity: 0.75,
324          weight: 1.5,
325          fill: true,
326          fillOpacity: 1.0,
327          color: '#888888',
328          fillColor: '#661323'
329        },
330        selected: // leaflet style for selected / highlighted station
331        {
332          color: '#2e6c97',
333          fillColor: '#2b83cb'
334        }
335      },
336      source: {
337        name: "Global Historical Climatology Network",
338        link: "https://www.ncdc.noaa.gov/ghcnm/",
339        description: "GHCN-Monthly provides climatological observations for four elements: monthly mean maximum temperature, minimum temperature, mean temperature, and monthly total precipitation. Since the early 1990s the Global Historical Climatology Network-Monthly (GHCN-M) dataset has been an internationally recognized source of data for the study of observed variability and change in land surface air temperature. It provides monthly mean temperature data for 7280 stations from 226 countries and territories, ongoing monthly updates of more than 2000 stations to support monitoring of current and evolving climate conditions, and homogeneity adjustments to remove non-climatic influences that can bias the observed temperature record."
340      }
341    }
342  };
343};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.