Changeset 12049 for issm/trunk-jpl/src/modules/Xy2ll/Xy2ll.cpp
- Timestamp:
- 04/18/12 15:16:17 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/modules/Xy2ll/Xy2ll.cpp
r11933 r12049 12 12 int nx,ny,ncoord; 13 13 int sgn; 14 15 14 Options* options=NULL; 16 15 double cm=0.,sp=0.; … … 25 24 /*checks on arguments on the matlab side: */ 26 25 if (nlhs > NLHS) { 27 Xy2llUsage(); 28 _error_("Xy2ll usage error"); 26 Xy2llUsage(); _error_("Xy2ll usage error"); 29 27 } 30 28 if (nrhs < NRHS) { 31 Xy2llUsage(); 32 _error_("Xy2ll usage error"); 29 Xy2llUsage(); _error_("Xy2ll usage error"); 33 30 } 34 31 35 32 /*Input datasets: */ 36 if (verbose) printf("Fetching inputs:\n");37 33 FetchData(&x,&nx,X_IN); 38 if (verbose)39 if (nx == 1) printf(" x=%g\n",x[0]);40 else printf(" x=[%d values]\n",nx);41 // for (i=0; i<nx; i++) printf(" x[%d]=%g\n",i,x[i]);42 34 FetchData(&y,&ny,Y_IN); 43 if (verbose)44 if (ny == 1) printf(" y=%g\n",y[0]);45 else printf(" y=[%d values]\n",ny);46 // for (i=0; i<ny; i++) printf(" y[%d]=%g\n",i,y[i]);47 35 FetchData(&sgn,SGN_IN); 48 if (verbose) printf(" sgn=%d\n",sgn);36 FetchData(&options,NRHS,nrhs,prhs); 49 37 50 if (verbose) printf("Parsing options:\n");51 options=new Options(NRHS,nrhs,prhs);52 if (options->Size()) for(i=0;i<options->Size();i++) ((Option*)options->GetObjectByOffset(i))->DeepEcho();53 38 /* defaults are in Xy2lldef, so don't duplicate them here, and only use user values if both have been specified */ 54 39 if (options->GetOption("central_meridian") || options->GetOption("standard_parallel")) { … … 60 45 61 46 /*some checks*/ 62 if (verbose) printf("Checking inputs:\n");63 64 47 if (nx != ny) _error_("Must have same number of x[%d] and y[%d] coordinates.",nx,ny); 65 48 else ncoord=nx; … … 68 51 if (sp < 0. || sp > 90.) _error_("Standard parallel sp=%g must be between 0 and 90 degrees (in specified hemisphere).",sp); 69 52 70 lat=(double *)xmalloc(ncoord*sizeof(double));71 lon=(double *)xmalloc(ncoord*sizeof(double));53 lat=(double*)mxMalloc(ncoord*sizeof(double)); 54 lon=(double*)mxMalloc(ncoord*sizeof(double)); 72 55 73 56 /* Run core computations: */ 74 57 if (verbose) printf("Calling core:\n"); 75 58 if (options->GetOption("central_meridian") && options->GetOption("standard_parallel")) 76 iret=Xy2llx(lat,lon, 77 x,y,ncoord, 78 sgn,cm,sp); 59 iret=Xy2llx(lat,lon,x,y,ncoord,sgn,cm,sp); 79 60 else 80 iret=Xy2llx(lat,lon, 81 x,y,ncoord, 82 sgn); 83 if (verbose) printf(" iret=%d\n",iret); 61 iret=Xy2llx(lat,lon,x,y,ncoord,sgn); 84 62 85 63 /*Write data: */ … … 94 72 } 95 73 96 void Xy2llUsage(void) 97 { 74 void Xy2llUsage(void){ 98 75 _printf_(true,"Xy2ll - x/y to lat/long coordinate transformation module:\n"); 99 76 _printf_(true,"\n");
Note:
See TracChangeset
for help on using the changeset viewer.