diff --git a/libsharp/sharp_geomhelpers.c b/libsharp/sharp_geomhelpers.c index ee8f4d5..bf55dab 100644 --- a/libsharp/sharp_geomhelpers.c +++ b/libsharp/sharp_geomhelpers.c @@ -242,7 +242,7 @@ void sharp_make_ecp_geom_info (int nrings, int nphi, double phi0, DEALLOC(stride_); } -static double eps(int j, int J) +static inline double eps(int j, int J) { if ((j==0)||(j==J)) return 0.5; if ((j>0)&&(jpi-1e-15) theta[m]=pi-1e-15; - nph[m]=ppring; - phi0_[m]=phi0; + theta[nrings-1-m]=pi-theta[m]; + nph[m]=nph[nrings-1-m]=ppring; + phi0_[m]=phi0_[nrings-1-m]=phi0; ofs[m]=(ptrdiff_t)m*stride_lat; - stride_[m]=stride_lon; + ofs[nrings-1-m]=(ptrdiff_t)((nrings-1-m)*stride_lat); + stride_[m]=stride_[nrings-1-m]=stride_lon; double wgt=0; double prefac=4*pi*eps(m,2*lmax)/lmax; for (int l=0; l<=lmax; ++l) - wgt+=eps(l,lmax)/(1-4*l*l)*cos((pi*m*l)/lmax); - weight[m]=prefac*wgt/nph[m]; + wgt+=eps(l,lmax)/(1-4*l*l)*cos((pi*((m*l)%(2*lmax)))/lmax); + weight[m]=weight[nrings-1-m]=prefac*wgt/nph[m]; } sharp_make_geom_info (nrings, nph, ofs, stride_, phi0_, theta, NULL, weight, diff --git a/libsharp/sharp_geomhelpers.h b/libsharp/sharp_geomhelpers.h index 8c04730..3011b83 100644 --- a/libsharp/sharp_geomhelpers.h +++ b/libsharp/sharp_geomhelpers.h @@ -70,7 +70,8 @@ void sharp_make_gauss_geom_info (int nrings, int nphi, int stride_lon, longitude. \note \a nrings must be an even number. \note The sphere is pixelized in a way that the colatitude of the first ring - is \a 0.5*(pi/nrings). There are no pixel centers at the poles. + is \a 0.5*(pi/nrings) and the colatitude of the last ring is + \a pi-0.5*(pi/nrings). There are no pixel centers at the poles. \ingroup geominfogroup */ void sharp_make_ecp_geom_info (int nrings, int nphi, double phi0, int stride_lon, int stride_lat, sharp_geom_info **geom_info);