Skip to content

Commit

Permalink
add convert_ps_to_pdf
Browse files Browse the repository at this point in the history
  • Loading branch information
Romain-Gauthier committed Oct 24, 2024
1 parent 74984c1 commit 89f3730
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ceasiompy/PyAVL/func/avlresults.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
import subprocess

from ceasiompy.utils.ceasiomlogger import get_logger
from ceasiompy.utils.commonxpath import AVL_AEROMAP_UID_XPATH
Expand Down Expand Up @@ -197,6 +198,19 @@ def get_avl_results(cpacs_path, cpacs_out_path, wkdir):
aeromap.add_coefficients(alt=alt, mach=mach, aos=aos, aoa=aoa, cd=cd, cl=cl, cms=cm)
aeromap.save()
cpacs.save_cpacs(cpacs_out_path, overwrite=True)

def convert_ps_to_pdf(wkdir):
"""Function to convert AVL 'plot.ps' to 'plot.pdf'.
Args:
wkdir (Path): Path to the working directory.
"""
if not Path(wkdir, "plot.ps").exists():
raise FileNotFoundError("File 'plot.ps' does not exist.")

subprocess.run(["ps2pdf", "plot.ps", "plot.pdf"], cwd=wkdir)
subprocess.run(["rm", "plot.ps"], cwd=wkdir)


# =================================================================================================
Expand Down

0 comments on commit 89f3730

Please sign in to comment.