davidfrantz / force

Framework for Operational Radiometric Correction for Environmental monitoring
GNU General Public License v3.0
172 stars 50 forks source link

allow # to comment out gdal options #232

Open maxfreu opened 1 year ago

davidfrantz commented 1 year ago

This is a good suggestion. But is it enough to test whether # is the 1st char?

Is there any scenario possible where # is part of the gdal option? If not, there might be a more generic solution

maxfreu commented 1 year ago

I have not yet come across any GDAL options containing #. Usually the prefix NUM is used to denote numbers, e.g. NUM_THREADS. There are many drivers and I didn't check all of them, but I think it's pretty safe to assume none of them has # in their options. If there's a more generic solution than this one here, I'm all ears; this was just easy to implement. But it's no way important, I think the drivers neglect all options they dont understand anyway.

davidfrantz commented 1 year ago

Yes, that makes sense. I believe a more generic solution would be to account for this in read_tagvalue() https://github.com/davidfrantz/force/blob/20f18482ceaaf110dd994adde3ef4b34a60ef775/src/cross-level/read-cl.c#L140

I believe this would work:

 buffer[strcspn(buffer, "\r\n#")] = 0;
 if (strlen(buffer) == 0) continue;

This would also allow for things like

BLOCKSIZE = 5# this is the blocksize