/** * @brief Performs actual photometric correction calculations * * This routine computes photometric correction using parameters * for the Hillier-Buratti-Hill equation. * * @author Kris Becker - 2/21/2010 * * @param parms Container of band-specific Hillier parameters * @param i Incidence angle in degrees * @param e Emission angle in degrees * @param g Phase angle in degrees * * @return double Photometric correction parameter */ double Hillier::photometry(const Parameters &parms, double i, double e, double g) const { // Ensure problematic values are adjusted if(i == 0.0) i = 10.E-12; if(e == 0.0) e = 10.E-12; // Convert to radians i *= rpd_c(); e *= rpd_c(); g *= parms.phaUnit; // Apply unit normalizer // Compute Lommel-Seeliger components double mu = cos(e); double mu0 = cos(i); double alpha = g; double alpha2 = g * g; // Simple Hillier photometric polynomial equation with exponential opposition // surge term. double rcal = (mu0 / (mu + mu0)) * (parms.b0 * exp(-parms.b1 * alpha) + parms.a0 + (parms.a1 * alpha) + (parms.a2 * alpha2) + (parms.a3 * alpha * alpha2) + (parms.a4 * alpha2 * alpha2)); return (rcal); }
int main (int argc, char **argv) { SpiceDouble lt; SpiceDouble ang; SpiceDouble v[3]; SpiceDouble pos[3]; int i; furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); // spkezp_c(299,0,"ITRF93","LT+S",399,v,<); // printf("POS: %f,%f,%f\n",v[0],v[1],v[2]); // exit(0); // abq roughly georec_c (-106.5*rpd_c(), 35.05*rpd_c(), 1.609344, 6378.137, (6378.137-6356.7523)/6378.137, pos); for (i=0; i<=86400; i+=3600) { // pos of sun from IAU_EARTH spkezp_c(10,i,"ITRF93","LT+S",399,v,<); printf("POS(%d): %f,%f,%f\n",i,v[0],v[1],v[2]); // angle between abq vector and sun vector (0 = zenith) ang = vsep_c (v,pos); // printf("%d %f\n",i,r2d(ang)); } return 0; }
int main(void) { furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); double stime = 1448953200, etime = 1454310000; double lat, lon, dl, noon, mindl, minnoon; for (lat = 22.; lat<=67.; lat+=1.) { for (lon = -74.; lon <= -71.; lon+=0.1) { double *results = bcriset(lat*rpd_c(),lon*rpd_c(), 0, stime, etime, "Sun", -5/6.*rpd_c(), ">"); mindl = 0.; minnoon = 0.; // we intentionally ignore first result, expect it to be wrong // TODO: this assumption is invalid, and, even if it were valid, // should be i=1, not i=2 for (int i=2; i<=100; i++) { // if we start seeing 0s, we are out of true answers if (results[2*i] < .001) {break;} // if the end result is too close to etime, result is inaccurate if (abs(results[2*i+1]-etime)<1) {continue;} // length of day and "noon" dl = results[2*i+1]-results[2*i]; noon = (results[2*i+1]+results[2*i])/2; // if day length is less than mindl (or mindl = 0), set mindl and // minnoon to current if (mindl < .01 || dl < mindl) { mindl = dl; minnoon = noon; } } // the start of December for this longitude (1448928000 = GMT // midnight Dec 1) double sod = 1448928000-240.*lon; // this is: minimal time of noon and length of day printf("%f %f %f %f %f\n", lat, lon, minnoon, mindl, 1+(minnoon-sod)/86400); } } return 0; }
/** * @brief Extracts necessary Hillier parameters from profile * * Given a profile read from the input PVL file, this method * extracts needed parameters (from Keywords) in the PVL profile * and creates a container of the converted values. * * @author Kris Becker - 2/22/2010 * * @param p Profile to extract/convert * * @return Hillier::Parameters Container of extracted values */ Hillier::Parameters Hillier::extract(const DbProfile &p) const { Parameters pars; pars.b0 = toDouble(ConfKey(p, "B0", toString(0.0))); pars.b1 = toDouble(ConfKey(p, "B1", toString(0.0))); pars.a0 = toDouble(ConfKey(p, "A0", toString(0.0))); pars.a1 = toDouble(ConfKey(p, "A1", toString(0.0))); pars.a2 = toDouble(ConfKey(p, "A2", toString(0.0))); pars.a3 = toDouble(ConfKey(p, "A3", toString(0.0))); pars.a4 = toDouble(ConfKey(p, "A4", toString(0.0))); pars.wavelength = toDouble(ConfKey(p, "BandBinCenter", toString(Null))); pars.tolerance = toDouble(ConfKey(p, "BandBinCenterTolerance", toString(Null))); // Determine equation units - defaults to Radians pars.units = ConfKey(p, "HillierUnits", QString("Radians")); pars.phaUnit = (pars.units.toLower() == "degrees") ? 1.0 : rpd_c(); return (pars); }
static VALUE rpd(VALUE self) { return DBL2NUM(rpd_c()); }