Author: echatellier Date: 2014-07-07 12:20:35 +0200 (Mon, 07 Jul 2014) New Revision: 43 Url: http://forge.codelutin.com/projects/isis-fish-community/repository/revisions... Log: Ajout d'un script pour rejouer un grand nombre d'export Added: trunk/scripts/RunExportOnManySimulationResult.java Added: trunk/scripts/RunExportOnManySimulationResult.java =================================================================== --- trunk/scripts/RunExportOnManySimulationResult.java (rev 0) +++ trunk/scripts/RunExportOnManySimulationResult.java 2014-07-07 10:20:35 UTC (rev 43) @@ -0,0 +1,78 @@ +/* + * #%L + * IsisFish data + * %% + * Copyright (C) 2014 Ifremer, Code Lutin, Chatellier Eric + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-2.0.html>. + * #L% + */ + +package scripts; + +import java.io.File; +import java.util.Arrays; +import java.util.List; + +import org.nuiton.topia.TopiaException; + +import exports.Abundances; +import exports.Biomasses; +import fr.ifremer.isisfish.datastore.SimulationStorage; +import fr.ifremer.isisfish.export.Export; +import fr.ifremer.isisfish.export.ExportHelper; + +/** + * Ce script sert à rejouer des exports sur un grand nombre de simulation en lisant le + * ResultStrage et en rejouant les fonctions d'export. + * + * @author Eric Chatellier + */ +public class RunExportOnManySimulationResult { + + // nom des exports a rejouer + protected List<Export> exports = Arrays.asList( + new Abundances(), + new Biomasses() + ); + + public void doAllExports() throws TopiaException { + // prefix des noms de simulations + String simulationPrefix = "as_test_"; + int simulationCount = 2000; + + // parcourt de chaque simualtion + for (int index = 0; index <= simulationCount; index++) { + + // get current simulation + String currentSimulationName = simulationPrefix + simulationCount; + SimulationStorage currentSimulation = SimulationStorage.getSimulation(currentSimulationName); + + // run each export for this simulation + File rootDirectory = currentSimulation.getDirectory(); + File exportDir = SimulationStorage.getResultExportDirectory(rootDirectory); + ExportHelper.doExport(currentSimulation, exportDir, exports, rootDirectory); + System.out.println("Exports done on simulation " + currentSimulationName); + + // close all + currentSimulation.closeStorage(); + } + } + + public static void main(String[] args) throws TopiaException { + RunExportOnManySimulationResult runExportJob = new RunExportOnManySimulationResult(); + runExportJob.doAllExports(); + } +} Property changes on: trunk/scripts/RunExportOnManySimulationResult.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native