From f928f84682eddf0d78550feeccf3bd114e175152 Mon Sep 17 00:00:00 2001 From: Sylvain GERARD Date: Wed, 8 Jan 2014 12:19:44 +0100 Subject: [PATCH 1/2] Fix file structure for ASA_WVI_1P --- src/epr_dddb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/epr_dddb.c b/src/epr_dddb.c index fa0e231..3e79806 100644 --- a/src/epr_dddb.c +++ b/src/epr_dddb.c @@ -1615,7 +1615,7 @@ static const struct RecordDescriptor ASAR_Wave_Geolocation_ADSR_asar_rec_data[] {"attach_flag", e_tid_uchar, "flag", 1, "1", "Attachment Flag (set to 1 if unable to compute the cross spectra for a given SLC imagette (i.e. no Cross Spectra MDSR corresponding to this ADSR), set to 0 otherwise)"}, {"center_lat", e_tid_int, "(1e-6) degrees", 4, "1", "Geodetic latitude of center point (positive north) This is the center point of the wave cell. It is calculated after the cross spectra processing, and thus may differ from the center sample latitude of the SLC imagette if slant range to ground range conve"}, {"center_long", e_tid_int, "(1e-6) degrees", 4, "1", "Geodetic longitude of center point (positive east)This is the center point of the wave cell. It is calculated after the cross spectra processing, and thus may differ from the center sample latitude of the SLC imagette if slant range to ground range conver"}, - {"spare_1", e_tid_spare, NULL, 4, "1", "Spare"} + {"heading", e_tid_float, "deg", 4, "1", "Subsatellite Track Heading. Relative to North of centre point."} }; static const struct RecordDescriptor ASAR_Wave_Param_ADSR_asar_rec_data[] = { @@ -3192,7 +3192,7 @@ static const struct DatasetDescriptor ASA_WVI_1P_dataset_data[] = { {"GEOLOCATION_ADS", "GEOLOCATION ADS", ASAR_Wave_Geolocation_ADSR_asar_rec_data, "Wave Mode Geolocation ADS"}, {"PROCESSING_PARAMS_ADS", "PROCESSING PARAMS ADS", ASAR_Wave_Param_ADSR_asar_rec_data, "Wave Mode processing parameters"}, {"CROSS_SPECTRA_MDS", "CROSS SPECTRA MDS", ASAR_Spectra_MDSR_asar_rec_data, "Measurement Data Set containing spectra. 1 MDSR per spectra."}, - {"SLC_IMAGETTE_MDS", "SLC IMAGETTE MDS", ASAR_Image_MDSR_SLC_asar_rec_data, "Measurement Data Set for a single imagette (corresponds to one spectrum MDSR)"}, + {"SLC_IMAGETTE_MDS_000", "SLC IMAGETTE MDS 000", ASAR_Image_MDSR_SLC_asar_rec_data, "Measurement Data Set for a single imagette (corresponds to one spectrum MDSR)"}, {"SLC_IMAGETTE_MDS_001", "SLC IMAGETTE MDS 001", ASAR_Image_MDSR_SLC_asar_rec_data, "Measurement Data Set for a single imagette (corresponds to one spectrum MDSR)"}, {"SLC_IMAGETTE_MDS_002", "SLC IMAGETTE MDS 002", ASAR_Image_MDSR_SLC_asar_rec_data, "Measurement Data Set for a single imagette (corresponds to one spectrum MDSR)"}, {"SLC_IMAGETTE_MDS_003", "SLC IMAGETTE MDS 003", ASAR_Image_MDSR_SLC_asar_rec_data, "Measurement Data Set for a single imagette (corresponds to one spectrum MDSR)"}, From 38688f45aa64d37472182a2c02faa63deac26565 Mon Sep 17 00:00:00 2001 From: Sylvain GERARD Date: Fri, 10 Jan 2014 16:04:07 +0100 Subject: [PATCH 2/2] Fix support for ASA_WVI_1P This product has no bands and no "LINE_LENGTH" field but it should still be possible to open files and read them. The dataset offset compared to the MPH + SPH size should be the first one different from 0 (otherwise it means the dataset is not attached to the file) --- src/epr_msph.c | 14 +++++++++----- src/epr_param.c | 5 +++-- src/epr_product.c | 14 ++++++-------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/epr_msph.c b/src/epr_msph.c index c0d64d1..6da189c 100644 --- a/src/epr_msph.c +++ b/src/epr_msph.c @@ -529,8 +529,8 @@ void epr_set_header_field_values(EPR_SRecord* record, EPR_SPtrArray* header_valu uint epr_compare_param(EPR_SProductId* product_id) { - EPR_SDSD* dsd; - uint of; + EPR_SDSD* dsd = NULL; + uint dsd_index = 0; epr_clear_err(); @@ -539,10 +539,14 @@ uint epr_compare_param(EPR_SProductId* product_id) return 0UL; } - of = epr_api.epr_head_size; - dsd = (EPR_SDSD*)epr_get_ptr_array_elem_at(product_id->dsd_array, 0); + for (dsd_index = 0; dsd_index < product_id->dsd_array->length; dsd_index++) { + dsd = (EPR_SDSD*)epr_get_ptr_array_elem_at(product_id->dsd_array, dsd_index); + if (dsd->ds_offset > 0) + break; + } + if (dsd->ds_offset == epr_api.epr_head_size) - return of; + return epr_api.epr_head_size; return 0UL; } diff --git a/src/epr_param.c b/src/epr_param.c index 4e59a56..923e627 100644 --- a/src/epr_param.c +++ b/src/epr_param.c @@ -192,8 +192,9 @@ int epr_set_dyn_dddb_params(EPR_SProductId* product_id) /* AATSR does NOT have any dynamic parameters in DDDB */ /* ASAR */ - else if ((strcmp(EPR_ENVISAT_PRODUCT_ASAR, epr_sub_string((char*)product_field->elems, 0, 3)) == 0) || - (strcmp(EPR_ENVISAT_PRODUCT_SAR, epr_sub_string((char*)product_field->elems, 0, 3)) == 0)) { + else if (((strcmp(EPR_ENVISAT_PRODUCT_ASAR, epr_sub_string((char*)product_field->elems, 0, 3)) == 0) || + (strcmp(EPR_ENVISAT_PRODUCT_SAR, epr_sub_string((char*)product_field->elems, 0, 3)) == 0)) && + (strncmp(product_id->id_string, "ASA_WVI_1P", 10) != 0)) { field = epr_get_field(product_id->sph_record, "LINE_LENGTH"); if (field == NULL) { diff --git a/src/epr_product.c b/src/epr_product.c index 9dac6c3..c37fa7d 100644 --- a/src/epr_product.c +++ b/src/epr_product.c @@ -208,16 +208,14 @@ EPR_SProductId* epr_open_product(const char* product_file_path) { epr_log(e_log_info, "creating band identifiers"); product_id->band_ids = epr_create_band_ids(product_id); - if (product_id->band_ids == NULL) { - epr_close_product(product_id); - return NULL; - } /* Get scene size */ - product_id->scene_width = epr_compute_scene_width(product_id); - product_id->scene_height = epr_compute_scene_height(product_id); - sprintf(message_buffer, "product scene raster size: %u x %u", product_id->scene_width, product_id->scene_height); - epr_log(e_log_debug, message_buffer); + if (product_id->band_ids != NULL) { + product_id->scene_width = epr_compute_scene_width(product_id); + product_id->scene_height = epr_compute_scene_height(product_id); + sprintf(message_buffer, "product scene raster size: %u x %u", product_id->scene_width, product_id->scene_height); + epr_log(e_log_debug, message_buffer); + } return product_id; }