You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, PyGMT only allows lower-case file extensions like pdf and png, but doesn't support upper-case extensions like PDF or PNG. The Windows OS is case insensitive, so both lower-case and upper-case file extensions should be allowed.
importpygmtfig=pygmt.Figure()
fig.basemap(region=[0, 10, 0, 10], frame=True)
fig.savefig("map.PNG")
---------------------------------------------------------------------------GMTInvalidInputTraceback (mostrecentcalllast)
CellIn[4], line1---->1fig.savefig("map.PNG")
Filepygmt/pygmt/figure.py:315, inFigure.savefig(self, fname, transparent, crop, anti_alias, show, **kwargs)
310ifext=="ps":
311raiseGMTInvalidInput(
312"Extension '.ps' is not supported. "313"Please use '.eps' or '.pdf' instead."314 )
-->315raiseGMTInvalidInput(f"Unknown extension '.{ext}'.")
316fmt=fmts[ext]
317iftransparent:
GMTInvalidInput: Unknownextension'.PNG'.
Are you willing to help implement and maintain this feature?
Maybe
The text was updated successfully, but these errors were encountered:
However, GMT's psconvert module can only generate files with lower-case extensions. It means when users give fig.savefig("map.PNG"), it no longer raise the GMTInvalidInput error, but it saves the image as map.png, unless we rename the files manually.
When dealing with file extensions provided by users or retrieved from external sources, normalize them to lowercase before processing. This ensures consistency.
Validation and Handling: Aafes Star Card
Ensure that your application correctly validates and handles files with uppercase or lowercase extensions. This includes loading, displaying, and processing the files.
File Type Mapping:
Maintain a mapping of file extensions to corresponding file types or actions in your application. Make sure this mapping is case-insensitive so that both uppercase and lowercase extensions trigger the correct behavior.
User Input Handling:
If your application allows users to input file extensions (e.g., in filters or preferences), make sure that it gracefully handles both uppercase and lowercase inputs.
Description of the desired feature
Currently, PyGMT only allows lower-case file extensions like pdf and png, but doesn't support upper-case extensions like PDF or PNG. The Windows OS is case insensitive, so both lower-case and upper-case file extensions should be allowed.
Are you willing to help implement and maintain this feature?
Maybe
The text was updated successfully, but these errors were encountered: