/*************************************************************** * Ceos_init_stVec: * Reads state vectors from given CEOS file, writing them in the * appropriate format to SAR parameters structure.*/ void ceos_init_stVec(const char *fName, ceos_description *ceos, meta_parameters *meta) { struct pos_data_rec ppdr; /*Fetch platform position data record.*/ get_ppdr(fName,&ppdr); // Read the state vectors from the leader data file, adjust coordinate system, etc. // and write them to the SAR parameters structures ceos_read_stVecs(fName, ceos, meta); // Propagate three state vectors for regular frames if (ceos->processor != PREC && ceos->processor != unknownProcessor) { int vector_count=3; double data_int = meta->sar->original_line_count / 2 * fabs(meta->sar->azimuth_time_per_pixel); meta->state_vectors->vecs[0].time = get_timeDelta(ceos, &ppdr, meta); if (ceos->processor != PREC && data_int < 360.0) { while (fabs(data_int) > 15.0) { data_int /= 2; vector_count = vector_count*2-1; } // propagate three state vectors: start, center, end propagate_state(meta, vector_count, data_int); } } }
/************************************************************************** * atct_init_from_leader: * calculates alpha1, alpha2, and alpha3, which are some sort of coordinate * rotation amounts, in degrees. This creates a latitude/longitude-style * coordinate system centered under the satellite at the start of imaging. * Rather than using a passed-in state vector, the initial state vector is * read from the leader file. */ void atct_init_from_leader(const char *leaderName, meta_projection *proj) { struct dataset_sum_rec *dssr = NULL; meta_parameters *meta = raw_init(); stateVector st_start; ceos_description *ceos = get_ceos_description_ext(leaderName, REPORT_LEVEL_NONE, FALSE); // Azimuth time per pixel need to be known for state vector propagation dssr = &ceos->dssr; ceos_init_sar_general(ceos, leaderName, meta, TRUE); ceos_read_stVecs(leaderName, ceos, meta); st_start = meta_get_stVec(meta, 0.0); fixed2gei(&st_start,0.0);/* Remove earth's spin JPL's AT/CT projection requires this */ atct_init(proj, st_start); meta_free(meta); }
/*************************************************************** * Ceos_init_stVec: * Reads state vectors from given CEOS file, writing them in the * appropriate format to SAR parameters structure.*/ void ceos_init_stVec(const char *fName, ceos_description *ceos, meta_parameters *meta) { struct pos_data_rec ppdr; /*Fetch platform position data record.*/ get_ppdr(fName,&ppdr); // Read the state vectors from the leader data file, adjust coordinate system, etc. // and write them to the SAR parameters structures ceos_read_stVecs(fName, ceos, meta); // For ALOS Palsar orbits only // Don't propagate but select nine state vectors around the center for the // higher order interpolation scheme if (ceos->processor == ALOS_PROC) { // Determine closest state vector int ii, min; double diff = 99999999; for (ii=0; ii<meta->state_vectors->vector_count; ii++) { if (fabs(meta->state_vectors->vecs[ii].time) < diff) { diff = fabs(meta->state_vectors->vecs[ii].time); min = ii; } } // Populate a new state vector ymd_date img_ymd; julian_date img_jd; hms_time img_time; img_jd.year = meta->state_vectors->year; img_jd.jd = meta->state_vectors->julDay; date_sec2hms(meta->state_vectors->second,&img_time); date_jd2ymd(&img_jd, &img_ymd); add_time((min-4)*60, &img_ymd, &img_time); date_ymd2jd(&img_ymd, &img_jd); meta_state_vectors *new_st = meta_state_vectors_init(9); new_st->year = img_jd.year; new_st->julDay = img_jd.jd; new_st->second = date_hms2sec(&img_time); for (ii=0; ii<9; ii++) new_st->vecs[ii] = meta->state_vectors->vecs[ii+min-4]; FREE(meta->state_vectors); meta->state_vectors = new_st; // Time shift should definitely set in the code that is calling this function // meta->sar->time_shift = 0.0; } // Propagate three state vectors for regular frames else if (ceos->processor != PREC && ceos->processor != unknownProcessor) { int vector_count=3; double data_int = meta->sar->original_line_count / 2 * fabs(meta->sar->azimuth_time_per_pixel); meta->state_vectors->vecs[0].time = get_timeDelta(ceos, &ppdr, meta); if (ceos->processor != PREC && data_int < 360.0) { while (fabs(data_int) > 15.0) { data_int /= 2; vector_count = vector_count*2-1; } // propagate three state vectors: start, center, end propagate_state(meta, vector_count, data_int); } } }