| [2743] | 1 | //#define TEST_MOLLWEIDE
 | 
|---|
 | 2 | #include <stdlib.h>
 | 
|---|
 | 3 | #include <stdio.h>
 | 
|---|
 | 4 | #include <math.h>
 | 
|---|
 | 5 | #include "sopnamsp.h"
 | 
|---|
 | 6 | #include "mollweide.h"
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | int main()
 | 
|---|
 | 9 | {
 | 
|---|
 | 10 |  FILE *file  = fopen("mollw.data","w");
 | 
|---|
 | 11 |  FILE *file2 = fopen("mollw2.data","w");
 | 
|---|
 | 12 |  int i,npoints=250000;
 | 
|---|
 | 13 |  double tvrai,lon,lat,x,y,tcalc,a;
 | 
|---|
 | 14 |  double longitude,latitude,tll,txy;
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 |  tll=txy=0.;
 | 
|---|
 | 17 |  for(i=0;i<=npoints;i++) {
 | 
|---|
 | 18 |    //tvrai = 1.57078;
 | 
|---|
 | 19 |    tvrai = (double)i*(M_PI_2) /(double)npoints;
 | 
|---|
 | 20 |    a = 2.*tvrai+sin(2.*tvrai);
 | 
|---|
 | 21 |    lat = asin(a/M_PI);
 | 
|---|
| [3572] | 22 |    tcalc = MollWeide_XY(0.,lat,x,y);
 | 
|---|
| [2743] | 23 |    if(fabs(tcalc-tvrai)>tll) {tll = fabs(tcalc-tvrai); txy=tvrai;}
 | 
|---|
 | 24 |    if(file) fprintf(file,"%e %e %e %e\n",tvrai,tcalc,a,tcalc-tvrai);
 | 
|---|
 | 25 |  }
 | 
|---|
 | 26 |  printf("Maximum difference: %e for t=%.10e=Pi/2-%.10e\n",tll,txy,M_PI_2-txy);
 | 
|---|
 | 27 |  if(file) fclose(file);
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 |  for(lon=0.;lon<360.;lon+=2.5) for(lat=-90.;lat<=90.1;lat+=2.5) {
 | 
|---|
| [3572] | 30 |    txy = MollWeide_XY(lon*M_PI/180.,lat*M_PI/180.,x,y);
 | 
|---|
 | 31 |    tll = MollWeide_LL(x,y,longitude,latitude);
 | 
|---|
| [2743] | 32 |    longitude *= 180./M_PI;
 | 
|---|
 | 33 |    latitude  *= 180./M_PI;
 | 
|---|
 | 34 |    if(file2) fprintf(file2,"%e %e %e %e %e %e %e %e %e %e\n"
 | 
|---|
 | 35 |      ,lon,lat,x,y,longitude,latitude,txy,tll,longitude-lon,latitude-lat);
 | 
|---|
 | 36 |  }
 | 
|---|
 | 37 |  if(file2) fclose(file2);
 | 
|---|
 | 38 |  return 0;
 | 
|---|
 | 39 | }
 | 
|---|