Changeset 9074


Ignore:
Timestamp:
07/19/11 16:28:29 (14 years ago)
Author:
Mathieu Morlighem
Message:

size of x_m and y_m are now the same as matric size

Location:
issm/trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/InterpFromMeshToGridx/InterpFromMeshToGridx.cpp

    r8159 r9074  
    1111        /*Output*/
    1212        double* griddata=NULL;
    13         double* x_m=NULL;
    14         double* y_m=NULL;
     13        double* x_grid=NULL;
     14        double* y_grid=NULL;
    1515
    1616        /*Intermediary*/
     
    2828        double data_value;
    2929        double cornersouth;
    30         double* x_grid=NULL;
    31         double* y_grid=NULL;
    3230
    3331        /*some checks*/
     
    4947        /*First, allocate pointers: */
    5048        griddata=(double*)xcalloc(nlines*ncols,sizeof(double));
    51         x_m=(double*)xcalloc(ncols+1,sizeof(double));
    52         y_m=(double*)xcalloc(nlines+1,sizeof(double));
    5349        x_grid=(double*)xcalloc(ncols,sizeof(double));
    5450        y_grid=(double*)xcalloc(nlines,sizeof(double));
     
    6561        /*Compute coordinates lists*/
    6662        // EAST = ACTUAL WEST !!!!!!!!!!!!!!!
    67         cornersouth=cornernorth-nlines*yposting;
    68         for(i=0;i<nlines;i++) y_grid[i]= cornersouth + yposting/2 + yposting*i;
    69         for(i=0;i<ncols; i++) x_grid[i]= cornereast  + xposting/2 + xposting*i;
    70         for(i=0;i<=nlines;i++)   y_m[i]= cornersouth + yposting*i;
    71         for(i=0;i<=ncols; i++)   x_m[i]= cornereast  + xposting*i;
     63        cornersouth=cornernorth-(nlines-1)*yposting;
     64        for(i=0;i<nlines;i++)   y_grid[i]= cornersouth + yposting*i;
     65        for(i=0;i<ncols; i++)   x_grid[i]= cornereast  + xposting*i;
    7266
    7367        /*Initialize coordintes and griddata*/
     
    180174        /*Assign output pointers:*/
    181175        *pgriddata=griddata;
    182         *px_m=x_m;
    183         *py_m=y_m;
     176        *px_m=x_grid;
     177        *py_m=y_grid;
    184178}
  • issm/trunk/src/m/model/kmlimagesc.m

    r7467 r9074  
    5151[x_m,y_m,field]=InterpFromMeshToGrid(md.elements,md.long,md.lat,field,minlong,maxlat,posting,posting,nlines,ncols,NaN);
    5252field=flipud(field);
    53 x_m=(x_m(1:end-1)+x_m(2:end))/2;
    54 y_m=(y_m(1:end-1)+y_m(2:end))/2;
    5553
    5654%massage  and log:
  • issm/trunk/src/mex/InterpFromMeshToGrid/InterpFromMeshToGrid.cpp

    r8910 r9074  
    5151
    5252        /*Write results: */
    53         WriteMatlabData(XM,x_m,ncols+1);
    54         WriteMatlabData(YM,y_m,nlines+1);
     53        WriteMatlabData(XM,x_m,ncols);
     54        WriteMatlabData(YM,y_m,nlines);
    5555        WriteMatlabData(GRIDDATA,griddata,nlines,ncols);
    5656
Note: See TracChangeset for help on using the changeset viewer.