Changeset 8689


Ignore:
Timestamp:
06/22/11 15:51:08 (14 years ago)
Author:
jschierm
Message:

Updated versions of Xy2ll and Ll2xy modules and x-layers.

Location:
issm/trunk/src
Files:
4 edited

Legend:

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

    r8673 r8689  
    2828
    2929        double  delta,slat;
    30         bool    flag=false;
     30        bool    flag=true;
    3131
    3232        /*  Get central_meridian and standard_parallel depending on hemisphere  */
     
    3434                delta = 45;
    3535                slat = 70;
    36                 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45)");
     36                _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n");
    3737        }
    3838        else if (sgn == -1) {
    3939                delta = 0;
    4040                slat = 71;
    41                 _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0)");
     41                _printf_(flag,"Info: creating coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n");
    4242        }
    4343        else
    44                 _error_("Sign should be either +1 or -1");
     44                _error_("Sign should be either +1 or -1.\n");
    4545
    46         return(Ll2xyx(lat,lon,
    47                                   x,y,ncoord,
     46        return(Ll2xyx(x,y,
     47                                  lat,lon,ncoord,
    4848                                  sgn,delta,slat));
    4949}
     
    6868*/
    6969
    70         int     i;
     70        int     i,iret=0;
    7171        double  delta,slat;
    7272        double  cde,re,ex2,ex,pi;
     
    7575
    7676        if      ((sgn !=  1) && (sgn != -1))
    77                 _error_("Sign should be either +1 or -1");
     77                _error_("Sign should be either +1 or -1.\n");
    7878
    7979        delta = central_meridian;
     
    109109                }
    110110
    111                 y[i] = -rho * sgn * cos(sgn*longitude);
    112                 x[i] =  rho * sgn * sin(sgn*longitude);
     111                y[i] = -rho * (double)sgn * cos((double)sgn*longitude);
     112                x[i] =  rho * (double)sgn * sin((double)sgn*longitude);
    113113
    114114                if (latitude >= pi / 2.) {
    115115                        x[i] = 0.0;
    116116                        y[i] = 0.0;
     117                        iret=1;
    117118                }
    118119        }
    119120
    120         return(0);
     121        return(iret);
    121122}
    122123
  • issm/trunk/src/c/modules/Xy2llx/Xy2llx.cpp

    r8673 r8689  
    2929
    3030        double  delta,slat;
    31         bool    flag=false;
     31        bool    flag=true;
    3232
    3333        /*  Get central_meridian and standard_parallel depending on hemisphere  */
     
    3535                delta = 45;
    3636                slat = 70;
    37                 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45)");
     37                _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 70N Meridian: 45).\n");
    3838        }
    3939        else if (sgn == -1) {
    4040                delta = 0;
    4141                slat = 71;
    42                 _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0)");
     42                _printf_(flag,"Warning: expecting coordinates in polar stereographic (Std Latitude: 71S Meridian: 0).\n");
    4343        }
    4444        else
    45                 _error_("Sign should be either +1 or -1");
     45                _error_("Sign should be either +1 or -1.\n");
    4646
    4747        return(Xy2llx(lat,lon,
     
    7070*/
    7171
    72         int     i;
     72        int     i,iret=0;
    7373        double  delta,slat;
    7474        double  cde,re,ex2,ex,pi;
     
    7676
    7777        if      ((sgn !=  1) && (sgn != -1))
    78                 _error_("Sign should be either +1 or -1");
     78                _error_("Sign should be either +1 or -1.\n");
    7979
    8080        delta = central_meridian;
     
    117117                        lat[i] = 90. * (double)sgn;
    118118                        lon[i] = 0.0;
     119                        iret=1;
    119120                }
    120121
     
    124125        }
    125126
    126         return(0);
     127        return(iret);
    127128}
    128129
  • issm/trunk/src/mex/Ll2xy/Ll2xy.cpp

    r8681 r8689  
    1818        /* output: */
    1919        double  *x=NULL,*y=NULL;
     20        int     iret=0;
    2021
    2122        /*Boot module: */
     
    3839                if   (nlat == 1) printf("  lat=%g\n",lat[0]);
    3940                else             printf("  lat=[%d values]\n",nlat);
     41//      for (i=0; i<nlat; i++) printf("  lat[%d]=%g\n",i,lat[i]);
    4042        FetchData(&lon,&nlon,LON_IN);
    4143        if (verbose)
    4244                if   (nlon == 1) printf("  lon=%g\n",lon[0]);
    4345                else             printf("  lon=[%d values]\n",nlon);
     46//      for (i=0; i<nlon; i++) printf("  lon[%d]=%g\n",i,lon[i]);
    4447        FetchData(&sgn,SGN_IN);
    4548        if (verbose) printf("  sgn=%d\n",sgn);
     
    7174        if (verbose) printf("Calling core:\n");
    7275        if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
    73                 Ll2xyx(x,y,
    74                            lat,lon,ncoord,
    75                            sgn,cm,sp);
     76                iret=Ll2xyx(x,y,
     77                                        lat,lon,ncoord,
     78                                        sgn,cm,sp);
    7679        else
    77                 Ll2xyx(x,y,
    78                            lat,lon,ncoord,
    79                            sgn);
     80                iret=Ll2xyx(x,y,
     81                                        lat,lon,ncoord,
     82                                        sgn);
     83        if (verbose) printf("  iret=%d\n",iret);
    8084
    8185        /*Write data: */
  • issm/trunk/src/mex/Xy2ll/Xy2ll.cpp

    r8681 r8689  
    1818        /* output: */
    1919        double  *lat=NULL,*lon=NULL;
     20        int     iret=0;
    2021
    2122        /*Boot module: */
     
    3839                if   (nx == 1) printf("  x=%g\n",x[0]);
    3940                else           printf("  x=[%d values]\n",nx);
     41//      for (i=0; i<nx; i++) printf("  x[%d]=%g\n",i,x[i]);
    4042        FetchData(&y,&ny,Y_IN);
    4143        if (verbose)
    4244                if   (ny == 1) printf("  y=%g\n",y[0]);
    4345                else           printf("  y=[%d values]\n",ny);
     46//      for (i=0; i<ny; i++) printf("  y[%d]=%g\n",i,y[i]);
    4447        FetchData(&sgn,SGN_IN);
    4548        if (verbose) printf("  sgn=%d\n",sgn);
     
    7174        if (verbose) printf("Calling core:\n");
    7275        if (options->GetOption("central_meridian") && options->GetOption("standard_parallel"))
    73                 Xy2llx(lat,lon,
    74                            x,y,ncoord,
    75                            sgn,cm,sp);
     76                iret=Xy2llx(lat,lon,
     77                                        x,y,ncoord,
     78                                        sgn,cm,sp);
    7679        else
    77                 Xy2llx(lat,lon,
    78                            x,y,ncoord,
    79                            sgn);
     80                iret=Xy2llx(lat,lon,
     81                                        x,y,ncoord,
     82                                        sgn);
     83        if (verbose) printf("  iret=%d\n",iret);
    8084
    8185        /*Write data: */
Note: See TracChangeset for help on using the changeset viewer.