Changeset 561


Ignore:
Timestamp:
09/28/12 15:23:24 (12 years ago)
Author:
vmipsl
Message:

simulation

  • contours ok
Location:
ether_megapoli/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/service/implementation/com/ether/EtherPlotContentServiceImpl.java

    r559 r561  
    267267        final SGTMetaData yMeta = new SGTMetaData( bundle.getString( "plot.latitude" ), bundle.getString( "plot.degres" ) ); 
    268268 
     269        // TODO : use layers instead of add real data to simulated data 
    269270        if( megapoliPlot.isRealDataToDisplay() && null != megapoliPlot.getRealData() ) 
    270271        { 
     
    285286        final Double min = Collections.min( parameterValues ); 
    286287        final Double max = Collections.max( parameterValues ); 
    287         final Double delta = ( max - min ) / _numberOfColorsFor2D; 
     288        final Double delta = ( max - min ) / _numberOfContoursForSimulation; 
    288289        final Range2D datar = new Range2D( min, max, delta ); 
    289290        final ContourLevels clevels = ContourLevels.getDefault( datar ); 
    290         final ColorMap cmap = createColorMap( datar, 200 ); 
     291        final ColorMap cmap = createColorMap( datar, _numberOfColorsForSimulation ); 
    291292 
    292293        // Create a gridAttribute for contour data 
     
    852853    protected Integer _intervalsNumber = 10; 
    853854    protected Integer _numberOfColorsFor2D = 64; 
     855    protected Integer _numberOfColorsForSimulation = 200; 
     856    protected Integer _numberOfContoursForSimulation = 15; 
    854857 
    855858    private EtherService _etherService; 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java

    r557 r561  
    294294        final BufferedImage jPaneBufferedImage = new BufferedImage( jPane.getWidth(), jPane.getHeight(), BufferedImage.TYPE_INT_ARGB ); 
    295295        final Graphics2D graphics2D = jPaneBufferedImage.createGraphics(); 
     296        final Font font = new Font( "Helvetica", Font.PLAIN, 8 ); 
     297        graphics2D.setFont( font ); 
    296298        jPane.addNotify(); 
    297299        jPane.validate(); 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java

    r559 r561  
    10141014 
    10151015    /** 
    1016      * This method reduce the simulated date in the same geographic map of the real data 
     1016     * This method reduce the geographic map of the simulated data to the geographic map of the real data 
     1017     * We extract only the simulated data which are in the geographic map of the real data 
    10171018     * 
    10181019     * @param allParameterValues 
     
    10641065    } 
    10651066 
     1067    /** 
     1068     * This method flip the list 
     1069     * We need this operation because the ploting is lon0[lat0,lat1,lat2], lon1[lat0,lat1,lat2]... and the values extract from the file are given as lat0[lon0,lon1], lat1[lon0, lon1], lat2[lon0,lon1]... 
     1070     * 
     1071     * @param list 
     1072     * @param sizeLatitude 
     1073     * @param sizeLongitude 
     1074     * @return 
     1075     */ 
     1076    @NotNull 
     1077    public List<Double> flipList( @NotNull final List<Double> list, @NotNull final Integer sizeLatitude, @NotNull final Integer sizeLongitude ) 
     1078    { 
     1079        final List<Double> flipedList = new ArrayList<Double>( list.size() ); 
     1080        for( int lon = 0; lon < sizeLongitude; lon++ ) 
     1081            for( int lat = 0; lat < sizeLatitude; lat++ ) 
     1082            { 
     1083                flipedList.add( list.get( lon + lat * sizeLongitude ) ); 
     1084            } 
     1085        return flipedList; 
     1086    } 
     1087 
    10661088    @Nullable 
    10671089    private Integer getNearestIndex( @NotNull final List<Double> list, @NotNull final Double value, final boolean isForMinimum ) 
  • ether_megapoli/trunk/service/implementation/gov/noaa/pmel/sgt/GridCartesianRenderer.java

    r560 r561  
    213213        else 
    214214        { 
    215             // VMIPSL 
    216             if( ( (SimpleGrid) grid_ ).isFullGridForRasterContour() ) 
     215            for( xLon = 0; xLon < xSize; xLon++ ) 
    217216            { 
    218217                for( yLat = 0; yLat < ySize; yLat++ ) 
    219218                { 
    220                     for( xLon = 0; xLon < xSize; xLon++ ) 
    221                     { 
    222                         val = gValues[count]; 
    223                         if( !Double.isNaN( val ) ) 
    224                         { 
    225                             color = attr_.getColorMap().getColor( val ); 
    226                             g.setColor( color ); 
    227                             drawRect( g, xp[xLon], yp[yLat], xp[xLon + 1], yp[yLat + 1] ); 
    228                         } 
    229                         count++; 
    230                     } 
    231                 } 
    232             } 
    233             else 
    234             { 
    235                 for( xLon = 0; xLon < xSize; xLon++ ) 
    236                 { 
    237                     for( yLat = 0; yLat < ySize; yLat++ ) 
    238                     { 
    239                         val = gValues[count]; 
    240                         if( !Double.isNaN( val ) ) 
    241                         { 
    242                             color = attr_.getColorMap().getColor( val ); 
    243                             g.setColor( color ); 
    244                             drawRect( g, xp[xLon], yp[yLat], xp[xLon + 1], yp[yLat + 1] ); 
    245                         } 
    246                         count++; 
    247                     } 
     219                    val = gValues[count]; 
     220                    if( !Double.isNaN( val ) ) 
     221                    { 
     222                        color = attr_.getColorMap().getColor( val ); 
     223                        g.setColor( color ); 
     224                        drawRect( g, xp[xLon], yp[yLat], xp[xLon + 1], yp[yLat + 1] ); 
     225                    } 
     226                    count++; 
    248227                } 
    249228            } 
  • ether_megapoli/trunk/service/implementation/gov/noaa/pmel/sgt/contour/ContourLine.java

    r192 r561  
    1313package gov.noaa.pmel.sgt.contour; 
    1414 
    15 import java.util.Vector; 
    16 import java.util.Enumeration; 
    17  
    18 import java.awt.Graphics; 
    19 import java.awt.Color; 
    20  
     15import gov.noaa.pmel.sgt.CartesianGraph; 
    2116import gov.noaa.pmel.sgt.ContourLineAttribute; 
    2217import gov.noaa.pmel.sgt.DefaultContourLineAttribute; 
     18import gov.noaa.pmel.sgt.JPane; 
     19import gov.noaa.pmel.sgt.LayerNotFoundException; 
     20import gov.noaa.pmel.sgt.LineAttribute; 
    2321import gov.noaa.pmel.sgt.SGLabel; 
    24 import gov.noaa.pmel.sgt.LayerNotFoundException; 
    25 import gov.noaa.pmel.sgt.CartesianGraph; 
    26 import gov.noaa.pmel.sgt.JPane; 
    27 import gov.noaa.pmel.sgt.LineAttribute; 
    2822import gov.noaa.pmel.sgt.StrokeDrawer; 
    29  
     23import gov.noaa.pmel.util.GeoDate; 
    3024import gov.noaa.pmel.util.Point2D; 
    31 import gov.noaa.pmel.util.GeoDate; 
     25 
     26import java.awt.*; 
     27import java.util.Enumeration; 
     28import java.util.Vector; 
    3229 
    3330/** 
     
    314311      label.setAngle(angle); 
    315312      label.setLocationP(new Point2D.Double(xlab, ylab)); 
     313        // VMIPSL 
     314        label.setFont( g.getFont() ); 
    316315      try { 
    317316        label.draw(g); 
  • ether_megapoli/trunk/service/interface/com/ether/EtherService.java

    r559 r561  
    238238    @NotNull 
    239239    Data makeZoom( @NotNull final List<Double> allParameterValues, @NotNull final List<Double> allLatitudeValues, @NotNull final List<Double> allLongitudeValues, @Nullable final Data realData ); 
     240 
     241    @NotNull 
     242    List<Double> flipList( @NotNull final List<Double> list, @NotNull final Integer sizeLatitude, @NotNull final Integer sizeLongitude ); 
    240243} 
  • ether_megapoli/trunk/web/src/com/ether/ControllerSimulationPlot.java

    r559 r561  
    8585            megapoliPlot.setRealDataToDisplay( displayRealData ); 
    8686 
    87             if( displayRealData && null != plateformId ) 
     87            // Extract simulated values from file 
     88            final List<Double> allParameterValues = _etherService.extractValuesByModelByVariableByDateByLevelFromFile( megapoliPlot.getModelId(), megapoliPlot.getVariableName(), dateNumber, level, true ); 
     89            final List<Double> allLatitudeValues = _etherService.extractValuesByModelByVariableByDateByLevelFromFile( megapoliPlot.getModelId(), "lat", dateNumber, level, true ); 
     90            final List<Double> allLongitudeValues = _etherService.extractValuesByModelByVariableByDateByLevelFromFile( megapoliPlot.getModelId(), "lon", dateNumber, level, true ); 
     91 
     92            // Extract real data from database 
     93            if( megapoliPlot.isRealDataToDisplay() && null != plateformId ) 
    8894            { 
    8995                final Integer parameterId = _etherService.getParameterByCode( variableName ); 
     
    100106            } 
    101107 
    102             final List<Double> allParameterValues = _etherService.extractValuesByModelByVariableByDateByLevelFromFile( megapoliPlot.getModelId(), megapoliPlot.getVariableName(), dateNumber, level, true ); 
    103             final List<Double> allLatitudeValues = _etherService.extractValuesByModelByVariableByDateByLevelFromFile( megapoliPlot.getModelId(), "lat", dateNumber, level, true ); 
    104             final List<Double> allLongitudeValues = _etherService.extractValuesByModelByVariableByDateByLevelFromFile( megapoliPlot.getModelId(), "lon", dateNumber, level, true ); 
    105  
    106             // If we have to display the real data, we need probably to zoom all the data on the same geographic map 
     108            // If we have to display the real data, we need probably to zoom all the data on the same geographic map, otherwise we keep all values 
    107109            final Data allZoomedData = _etherService.makeZoom( allParameterValues, allLatitudeValues, allLongitudeValues, megapoliPlot.getRealData() ); 
    108  
    109110            final List<Double> parameterValues = (List<Double>) allZoomedData.getFirstArray(); 
    110111            final List<Double> latitudeValues = (List<Double>) allZoomedData.getSecondArray(); 
     
    112113 
    113114            final Data valuesLists; 
     115            // If we display the contours, the latitudes and longitudes must contain only unique value, we remove the duplicated values 
    114116            if( isRasterContour ) 
    115117            { 
    116118                final Set<Double> latitudeValuesSet = new LinkedHashSet<Double>( latitudeValues ); 
    117119                final Set<Double> longitudeValuesSet = new LinkedHashSet<Double>( longitudeValues ); 
    118                 valuesLists = new Data( parameterValues, new ArrayList<Double>( latitudeValuesSet ), new ArrayList<Double>( longitudeValuesSet ) ); 
     120                // We have to flip the parameter values 
     121                final List<Double> flipedParameterValues = _etherService.flipList( parameterValues, latitudeValuesSet.size(), longitudeValuesSet.size() ); 
     122                valuesLists = new Data( flipedParameterValues, new ArrayList<Double>( latitudeValuesSet ), new ArrayList<Double>( longitudeValuesSet ) ); 
    119123            } 
    120124            else 
    121125                valuesLists = new Data( parameterValues, new ArrayList<Double>( latitudeValues ), new ArrayList<Double>( longitudeValues ) ); 
     126 
    122127            megapoliPlot.setData( valuesLists ); 
    123128            megapoliPlot.setValuesNumber( parameterValues.size() ); 
  • ether_megapoli/trunk/web/visualization/visu_simulation-script.jsp

    r557 r561  
    190190            this.selectedVariable = false; 
    191191 
     192        // Unselect old plateform 
     193        this.selectPlateforms = false; 
     194 
    192195        // Change title 
    193196        $( "#textareaTitle" ).html( this.selectedModel.getName() + " _ " + this.selectedModel.jsonElement.version ); 
     
    210213        this.selectedVariable = objVariable; 
    211214        this.selectedVariable.select(); 
     215 
     216        // Unselect old plateform 
     217        this.selectPlateforms = false; 
    212218 
    213219        // Change title 
Note: See TracChangeset for help on using the changeset viewer.