<commit_before>'use strict';

define(['ol', 'toolbar', 'moment-interval', 'moment', 'layermanager', 'geojson', 'sidebar', 'query', 'search', 'print', 'permalink', 'measure', 'geolocation', 'api', 'cesium', 'ows', 'datasource_selector', 'cesiumjs', 'bootstrap'],

    function (ol, toolbar, momentinterval, moment, layermanager, geojson) {
        var module = angular.module('hs', [
            'hs.toolbar',
            'hs.layermanager',
            'hs.query',
            'hs.search', 'hs.print', 'hs.permalink',
            'hs.datasource_selector',
            'hs.geolocation',
            'hs.cesium',
            'hs.sidebar',
            'hs.ows'
        ]);

        module.directive('hs', ['hs.map.service', 'Core', '$compile', '$timeout', function (OlMap, Core, $compile, $timeout) {
            return {
                templateUrl: hsl_path + 'hslayers.html',
                link: function (scope, element) {
                    $timeout(function () { Core.fullScreenMap(element) }, 0);
                }
            };
        }]);

        module.directive('hs.hud', function () {
            return {
                templateUrl: './hud.html?bust=' + gitsha,
                link: function (scope, element, attrs) {

                }
            };
        });

        function getHostname() {
            var url = window.location.href
            var urlArr = url.split("/");
            var domain = urlArr[2];
            return urlArr[0] + "//" + domain;
        };

        function prepareTimeSteps(step_string) {
            var step_array = step_string.split(',');
            var steps = [];
            for (var i = 0; i < step_array.length; i++) {
                if (step_array[i].indexOf('/') == -1) {
                    steps.push(new Date(step_array[i]));
                    //console.log(new Date(step_array[i]).toISOString());
                } else {
                    //"2016-03-16T12:00:00.000Z/2016-07-16T12:00:00.000Z/P30DT12H"
                    var interval_def = step_array[i].split('/');
                    var step = moment.interval(interval_def[2]);
                    var interval = moment.interval(interval_def[0] + '/' + interval_def[1]);
                    while (interval.start() < interval.end()) {
                        //console.log(interval.start().toDate().toISOString());
                        steps.push(interval.start().toDate());
                        interval.start(moment.utc(interval.start().toDate()).add(step.period()));
                    }
                }
            }
            return steps;
        }

        var layers = [
            new ol.layer.Tile({
                source: new ol.source.OSM(),
                title: "OpenStreetMap",
                base: true,
                visible: false,
                minimumTerrainLevel: 15
            }),/*
            new ol.layer.Image({
                title: "Road segments of Open Transport Map vizualized by their average daily traffic volumes",
                source: new ol.source.ImageWMS({
                    url: 'https://intenzitadopravy.plzen.eu/wms-t',
                    params: {
                        LAYERS: 'may',
                        VERSION: '1.3.0',
                        FORMAT: "image/png",
                        INFO_FORMAT: "text/html",
                        time: '2018-03-28T09:00:00.000Z',
                        minimumTerrainLevel: 12
                    },
                    crossOrigin: null
                }),
                legends: ['http://gis.lesprojekt.cz/wms/transport/open_transport_map?service=WMS&request=GetLegendGraphic&layer=roads__traffic_volumes&version=1.3.0&format=image/png&sld_version=1.1.0'],
                maxResolution: 8550,
                visible: false,
                opacity: 0.7
            }),*/
        ];

        layers.push(new ol.layer.Image({
            title: 'Latest temperature',
            source: new ol.source.ImageWMS({
                url: 'http://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/copernicus_marine.map',
                params: {
                    LAYERS: 'temperature',
                    VERSION: '1.3.0',
                    FORMAT: "image/png",
                    INFO_FORMAT: "text/html"
                },
                crossOrigin: null
            }),
            legends: [`http://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/copernicus_marine.map?REQUEST=GetLegendGraphic&LAYER=temperature`],
            visible: true,
            opacity: 0.7,
        }));
        


        angular.forEach([
            {
                title: "Density ocean mixed layer thickness",
                layer: 'mlotst',
                style: 'boxfill/ferret',
                palette: 'ferret'
            },
            {
                title: "Sea surface height",
                layer: 'zos',
                style: 'boxfill/ncview',
                palette: 'ncview'
            },
            {
                title: "Sea floor potential temperature",
                layer: 'bottomT',
                style: 'boxfill/occam',
                palette: 'occam'
            },
            {
                title: "Sea ice thickness",
                layer: 'sithick',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Ice concentration",
                layer: 'siconc',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Temperature",
                layer: 'thetao',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Salinity",
                layer: 'so',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Automatically-generated sea ice velocity vector field",
                layer: 'sea_ice_velocity',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            }
        ], function (def) {
            layers.push(new ol.layer.Image({
                title: def.title,
                source: new ol.source.ImageWMS({
                    url: 'http://nrt.cmems-du.eu/thredds/wms/global-analysis-forecast-phy-001-024-monthly',
                    params: {
                        LAYERS: def.layer,
                        VERSION: '1.3.0',
                        FORMAT: "image/png",
                        INFO_FORMAT: "text/html",
                        time: '2018-02-15T00:00:00.000Z',
                        STYLE: def.style,
                        possible_times: prepareTimeSteps('2016-01-16T12:00:00.000Z,2016-02-15T12:00:00.000Z,2016-03-16T12:00:00.000Z/2016-07-16T12:00:00.000Z/P30DT12H,2016-08-16T12:00:00.000Z/2016-12-16T12:00:00.000Z/P30DT12H,2017-01-16T12:00:00.000Z,2017-02-15T00:00:00.000Z,2017-03-16T12:00:00.000Z/2017-07-16T12:00:00.000Z/P30DT12H,2017-08-16T12:00:00.000Z/2017-12-16T12:00:00.000Z/P30DT12H,2018-02-15T00:00:00.000Z')
                    },
                    crossOrigin: null
                }),
                legends: [`http://nrt.cmems-du.eu/thredds/wms/global-analysis-forecast-phy-001-024-monthly?REQUEST=GetLegendGraphic&LAYER=${def.layer}&PALETTE=${def.palette}`],
                visible: def.visible || false,
                opacity: 0.7,
                path: 'Physical indicators'
            }));
        });


        angular.forEach([
            {
                title: "Mole Concentration of Dissolved iron in Sea Water",
                layer: 'Fe',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },<commit_msg>Databio example Change service to the weekly one<commit_after>'use strict';

define(['ol', 'toolbar', 'moment-interval', 'moment', 'layermanager', 'geojson', 'sidebar', 'query', 'search', 'print', 'permalink', 'measure', 'geolocation', 'api', 'cesium', 'ows', 'datasource_selector', 'cesiumjs', 'bootstrap'],

    function (ol, toolbar, momentinterval, moment, layermanager, geojson) {
        var module = angular.module('hs', [
            'hs.toolbar',
            'hs.layermanager',
            'hs.query',
            'hs.search', 'hs.print', 'hs.permalink',
            'hs.datasource_selector',
            'hs.geolocation',
            'hs.cesium',
            'hs.sidebar',
            'hs.ows'
        ]);

        module.directive('hs', ['hs.map.service', 'Core', '$compile', '$timeout', function (OlMap, Core, $compile, $timeout) {
            return {
                templateUrl: hsl_path + 'hslayers.html',
                link: function (scope, element) {
                    $timeout(function () { Core.fullScreenMap(element) }, 0);
                }
            };
        }]);

        module.directive('hs.hud', function () {
            return {
                templateUrl: './hud.html?bust=' + gitsha,
                link: function (scope, element, attrs) {

                }
            };
        });

        function getHostname() {
            var url = window.location.href
            var urlArr = url.split("/");
            var domain = urlArr[2];
            return urlArr[0] + "//" + domain;
        };

        function prepareTimeSteps(step_string) {
            var step_array = step_string.split(',');
            var steps = [];
            for (var i = 0; i < step_array.length; i++) {
                if (step_array[i].indexOf('/') == -1) {
                    steps.push(new Date(step_array[i]));
                    //console.log(new Date(step_array[i]).toISOString());
                } else {
                    //"2016-03-16T12:00:00.000Z/2016-07-16T12:00:00.000Z/P30DT12H"
                    var interval_def = step_array[i].split('/');
                    var step = moment.interval(interval_def[2]);
                    var interval = moment.interval(interval_def[0] + '/' + interval_def[1]);
                    while (interval.start() < interval.end()) {
                        //console.log(interval.start().toDate().toISOString());
                        steps.push(interval.start().toDate());
                        interval.start(moment.utc(interval.start().toDate()).add(step.period()));
                    }
                }
            }
            return steps;
        }

        var layers = [
            new ol.layer.Tile({
                source: new ol.source.OSM(),
                title: "OpenStreetMap",
                base: true,
                visible: false,
                minimumTerrainLevel: 15
            }),/*
            new ol.layer.Image({
                title: "Road segments of Open Transport Map vizualized by their average daily traffic volumes",
                source: new ol.source.ImageWMS({
                    url: 'https://intenzitadopravy.plzen.eu/wms-t',
                    params: {
                        LAYERS: 'may',
                        VERSION: '1.3.0',
                        FORMAT: "image/png",
                        INFO_FORMAT: "text/html",
                        time: '2018-03-28T09:00:00.000Z',
                        minimumTerrainLevel: 12
                    },
                    crossOrigin: null
                }),
                legends: ['http://gis.lesprojekt.cz/wms/transport/open_transport_map?service=WMS&request=GetLegendGraphic&layer=roads__traffic_volumes&version=1.3.0&format=image/png&sld_version=1.1.0'],
                maxResolution: 8550,
                visible: false,
                opacity: 0.7
            }),*/
        ];

        layers.push(new ol.layer.Image({
            title: 'Latest temperature',
            source: new ol.source.ImageWMS({
                url: 'http://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/copernicus_marine.map',
                params: {
                    LAYERS: 'temperature',
                    VERSION: '1.3.0',
                    FORMAT: "image/png",
                    INFO_FORMAT: "text/html"
                },
                crossOrigin: null
            }),
            legends: [`http://gis.lesprojekt.cz/cgi-bin/mapserv?map=/home/dima/maps/copernicus_marine.map?REQUEST=GetLegendGraphic&LAYER=temperature`],
            visible: true,
            opacity: 0.7,
        }));
        


        angular.forEach([
            {
                title: "Density ocean mixed layer thickness",
                layer: 'mlotst',
                style: 'boxfill/ferret',
                palette: 'ferret'
            },
            {
                title: "Sea surface height",
                layer: 'zos',
                style: 'boxfill/ncview',
                palette: 'ncview'
            },
            {
                title: "Sea floor potential temperature",
                layer: 'bottomT',
                style: 'boxfill/occam',
                palette: 'occam'
            },
            {
                title: "Sea ice thickness",
                layer: 'sithick',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Ice concentration",
                layer: 'siconc',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Temperature",
                layer: 'thetao',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Salinity",
                layer: 'so',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
            {
                title: "Automatically-generated sea ice velocity vector field",
                layer: 'sea_ice_velocity',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            }
        ], function (def) {
            layers.push(new ol.layer.Image({
                title: def.title,
                source: new ol.source.ImageWMS({
                    url: 'http://nrt.cmems-du.eu/thredds/wms/global-analysis-forecast-phy-001-024?',
                    params: {
                        LAYERS: def.layer,
                        VERSION: '1.3.0',
                        FORMAT: "image/png",
                        INFO_FORMAT: "text/html",
                        time: '2018-02-15T00:00:00.000Z',
                        STYLE: def.style,
                        possible_times: prepareTimeSteps('2016-01-01T12:00:00.000Z/2018-04-28T12:00:00.000Z/P1D')
                    },
                    crossOrigin: null
                }),
                legends: [`http://nrt.cmems-du.eu/thredds/wms/global-analysis-forecast-phy-001-024??REQUEST=GetLegendGraphic&LAYER=${def.layer}&PALETTE=${def.palette}`],
                visible: def.visible || false,
                opacity: 0.7,
                path: 'Physical indicators'
            }));
        });


        angular.forEach([
            {
                title: "Mole Concentration of Dissolved iron in Sea Water",
                layer: 'Fe',
                style: 'boxfill/rainbow',
                palette: 'rainbow'
            },
{'fraction_non_alphanumeric': 0.1317966903073286, 'fraction_numerical': 0.03375361176779616, 'mean_word_length': 1.2679076693968727, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2455073', 'n_tokens_mistral': 4750, 'n_tokens_neox': 4141, 'n_words': 709}