/* * DataPreprocess.java * * Created on 24 April 2003, 17:32 */ package test; import uk.ac.leeds.ccg.grids.*; import java.io.*; /** * * @author jianhuij */ public class DataPreprocess { /** Creates a new instance of DataPreprocess */ public DataPreprocess() { } /** * @param args the command line arguments */ public static void main(String[] args) { File dir = new File( "D:/Jin/Work/medaction/sps/climate" ); String dirNew = "D:/Jin/Work/medaction/sps/climatenew/"; File[] all = dir.listFiles(); for ( int i = 0; i < all.length; i ++ ) { System.out.println( all[ i ].getName() ); File imageFile = new File( "D:/workspace/test" + i + ".png" ); Grid2DSquareCellDoubleFactory f = new Grid2DSquareCellDoubleFactory(); AbstractGrid2DSquareCellDouble modelGrid = f.createGrid2DSquareCellDouble( 720, 2400, -600, 2100, 1.0 , -9999.0 ); AbstractGrid2DSquareCellDouble grid = f.createGrid2DSquareCellDouble( all[ i ] ); //modelGrid.addToGrid( grid ); for ( int j = 0; j < 2400 * 720; j ++ ) { double x = modelGrid.getCellX( j ); double y = modelGrid.getCellY( j ); modelGrid.setCell( x, y , grid.getCell( x, y ) ); } System.out.println( dirNew + all[ i ].getName() ); Grid2DSquareCellDoubleExchange.toAsciiFile( modelGrid, new File( dirNew + all[ i ].getName() ) ); Grid2DSquareCellDoubleExchange.toImage( modelGrid, imageFile, "png" ); } } }