georasters icon indicating copy to clipboard operation
georasters copied to clipboard

When saving tiff, .tif occurs twice in filename

Open marthinwurer opened this issue 5 years ago • 5 comments

In code:

    one_deg.to_tiff(os.path.expanduser("~/path/to/dir/one_deg.tif"))

In file:

$ ls
one_deg.tif.tif

I expected that the file would just be named one_deg.tif, not .tif.tif

marthinwurer avatar Oct 08 '19 16:10 marthinwurer

Well since it is a to_tiff method, it assumes the you want the ending to be .tif. You do not need to assign it. I guess it is a preference issue.

ozak avatar Oct 08 '19 17:10 ozak

I could throw together a PR to check the ending of the path given, and just not add it if it's like tif or tiff or capitalized versions of those. Would that be acceptable?

marthinwurer avatar Oct 08 '19 17:10 marthinwurer

sure!

ozak avatar Oct 08 '19 18:10 ozak

I guess one could just put a replace on the string to delete any tif/tiff/TIF/TIFF endings

ozak avatar Oct 08 '19 18:10 ozak

Yeah, there are a few things that could be done. I'll take a look at the code and see which will work best. I'd prefer to err on the side of the user, as they're expecting what they put in to be what they get.

marthinwurer avatar Oct 08 '19 18:10 marthinwurer