Skip to content

Conversation

@sgerard
Copy link

@sgerard sgerard commented Jan 10, 2014

I've fixed some errors regarding the file structure of the product ASA_WVI_1P (bug [EPR-10] on the bug tracker, http://www.brockmann-consult.de/beam-jira/browse/EPR-10). There are also some modifications allowing to open and read files without bands (like ASA_WVI_1P files) and files with dataset descriptors referencing external datasets (not attached to the file).

Sylvain GERARD added 2 commits January 8, 2014 12:19
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)
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);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In principle the change makes sense but there are points in the code that assume product_id->band_ids to be not NULL, e.g.:

epr-api/src/epr_band.c

Lines 210 to 222 in 4ee3479

uint epr_get_num_bands(EPR_SProductId* product_id) {
epr_clear_err();
if (!epr_check_api_init_flag()) {
return 0;
}
if (product_id == NULL) {
epr_set_err(e_err_null_pointer,
"epr_get_num_bands: product_id must not be NULL");
return (uint) -1;
}
return product_id->band_ids->length;
}

and

epr-api/src/epr_band.c

Lines 224 to 238 in 4ee3479

EPR_SBandId* epr_get_band_id_at(EPR_SProductId* product_id, uint index) {
EPR_SBandId* band_id = NULL;
epr_clear_err();
if (product_id == NULL) {
epr_set_err(e_err_null_pointer,
"epr_get_band_id_at: product_id must not be NULL");
return NULL;
}
if (index >= product_id->band_ids->length) {
epr_set_err(e_err_index_out_of_range,
"epr_get_band_id_at: band index out of range");
return NULL;
}

@avalentino
Copy link
Collaborator

Superseded by #21

@avalentino avalentino closed this Jan 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants