Package it.geosolutions.geobatch.unredd.script.util

Examples of it.geosolutions.geobatch.unredd.script.util.FlowUtil


        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Starting statistic processing");
        }
        this.listenerForwarder.progressing(80, "Starting statistic processing");

        FlowUtil flowUtil= new FlowUtil(getTempDir(), getConfigDir());
        try {
          File dissRasterFile = new File(dstPath, filename);
            flowUtil.runStatsAndScripts(layerName, year, month, day, dissRasterFile, dstGeostore);
        } catch (FlowException e) {
            throw new ActionException(this, e.getMessage(), e);
        }
       
        // ****************************************
 
View Full Code Here


        }

        LOGGER.info("Starting reprocessing ChartScripts");
        this.listenerForwarder.progressing(50f, "Starting reprocessing ChartScripts");

        final FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());
        flowUtil.runScripts(geoStoreUtil, chartScripts);

        LOGGER.info("Reprocessing ChartScripts completed");
        this.listenerForwarder.setTask("Reprocessing ChartScripts completed");
        this.listenerForwarder.completed();
    }
View Full Code Here

        if( layerNames.isEmpty()) {
            LOGGER.warn("No layers defined for StatsDef '" + statsDefName+ "'");
        }

        final FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());

        // Loop on all layers on which this stat depends on
        int layers = layerNames.size();
        int layerCnt = 0;

        for (String layerName : layerNames) {
            float majorStep = layerCnt++ / layers;
            LOGGER.info("Starting reprocessing StatsDef:" + statsDefName + " layer:" + layerName);
            this.listenerForwarder.progressing(rescale(min, max, majorStep), "Reprocessing stats on layer " + layerName);

            Resource layerRes = geoStoreUtil.searchLayer(layerName);
            if(layerRes == null) {
                LOGGER.warn("Could not find Layer '"+layerName+"' for StatsDef '"+statsDefName+"'");
                continue;
            }
            UNREDDLayer layer = new UNREDDLayer(layerRes);

            List<Resource> layerUpdates = geoStoreUtil.searchLayerUpdateByLayer(layerName);
            LOGGER.info("Found " + layerUpdates.size() + " LayerUpdates for Layer " + layerName);

            // Compute stats for every time coordinate this layer has
            int layerUps = layerUpdates.size();
            int layerUpsCnt = 0;
            for (Resource layerUpdateRes : layerUpdates) {
                float minorStep = layerUpsCnt++ / layerUps;
                String msg = "Starting reprocessing StatsDef:" + statsDefName + " Layer:" + layerName + " LayerUpdate:" + layerUpdateRes.getName();
                LOGGER.info(msg);
                this.listenerForwarder.progressing(rescale(min, max, majorStep*(1+minorStep)), msg);

                UNREDDLayerUpdate layerUpdate = new UNREDDLayerUpdate(layerUpdateRes);
                String year = layerUpdate.getAttribute(UNREDDLayerUpdate.Attributes.YEAR);
                String month = layerUpdate.getAttribute(UNREDDLayerUpdate.Attributes.MONTH);
                String day = layerUpdate.getAttribute(UNREDDLayerUpdate.Attributes.DAY);

                String rasterPath = layer.getAttribute(Attributes.MOSAICPATH);
                String rasterFile = NameUtils.buildTifFileName(layerName, year, month, day);
                String rasterFullPath = new File(rasterPath, rasterFile).getAbsolutePath();

                Map<Tokens, String> tokens = FlowUtil.fillTokens(rasterFullPath, layerName, year, month, null);
                flowUtil.processStatistics(geoStoreUtil, statsDefRes, year, month, day, tokens);
            }
        }

        LOGGER.info("Reprocessing completed on StatsDef '" + statsDefName+ "'");
        this.listenerForwarder.progressing(max, "Reprocessing completed on StatsDef '" + statsDefName+ "'");
View Full Code Here

            if(LOGGER.isDebugEnabled())
                LOGGER.debug(" got info for chartScript to reprocess -->" + chartScriptName);
            chartScriptList.add(chartScriptResource);
        }

        FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());
        flowUtil.runScripts(geoStoreUtil, chartScriptList);
    }
View Full Code Here

        // ========================================
        // Compute all related statsData and chartData

        try {
            FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());
            flowUtil.runStatsAndScripts(layerName, year, month, day, rasterfile, geoStoreUtil);
        } catch (FlowException e) {
            throw new ActionException(this, e.getMessage(), e);
        }

    }
View Full Code Here

//        ShortResourceList res0 = geostoreClient.searchResources(chartDataFilter);
        ShortResourceList res0 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertTrue(res0.isEmpty());


        FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());
        flowUtil.runScripts(getGeoStoreUtil(), Arrays.asList(fullChartScript));

        ShortResourceList res1 = gstcu.getGeoStoreClient().searchResources(chartDataFilter);
        assertEquals(5, res1.getList().size());
    }
View Full Code Here

        String rasterfile = classFile.getAbsolutePath();

        Map<Tokens,String> tok = FlowUtil.fillTokens(rasterfile, null, null, null, null);

        FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());

        // repeat run twice:
        // first time stats will be INSERTed
        // second time stats will be UPDATEd
        for (int i = 0; i < 2; i++) {
            String statsOut = flowUtil.processStatistics(getGeoStoreUtil(), statsDef, YEAR, MONTH, DAY, tok);
    //        LOGGER.info(statsOut);
            long outlen = statsOut.length();

            assertTrue("Empty output", outlen>0);
View Full Code Here

        //---------------------
        // ok, some real testing now

        LOGGER.info("===== Run the code!");

        FlowUtil flowUtil = new FlowUtil(getTempDir(), getConfigDir());
        flowUtil.runStatsAndScripts(LAYERNAME, YEAR, MONTH, DAY, classFile, getGeoStoreUtil());

//---------------------
        LOGGER.info("===== Testing results");

        Resource loadedStatsData = gstcu.searchStatsData(STATSDEFNAME, YEAR, MONTH, DAY);
View Full Code Here

        if (LOGGER.isInfoEnabled()) {
            LOGGER.info("Starting statistic processing");
        }
        this.listenerForwarder.progressing(80, "Starting statistic processing");

        FlowUtil flowUtil= new FlowUtil(getTempDir(), getConfigDir());
        try {
            flowUtil.runStatsAndScripts(layername, year, month, day, rasterFile, geostore);
        } catch (FlowException e) {
            throw new ActionException(this, e.getMessage(), e);
        }

        /*************************
 
View Full Code Here

TOP

Related Classes of it.geosolutions.geobatch.unredd.script.util.FlowUtil

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.