2929@click .group ()
3030@click .version_option ()
3131def cli ():
32- """Rocket files Serializer .
33- This library has as objective to convert .ork file into parameters
34- that rocketpy is able to use for simulating the rocket . It will be generated
35- a .json file which you can use with a template simulation to execute the
36- simulation for your rocket .
32+ """RocketSerializer .
33+ This library has as objective to convert .ork files into parameters.json, so
34+ that they can be used in rocketpy simulations . It also provides the option
35+ to convert the parameters .json file into a .ipynb file, so that the user can
36+ run the simulation using Jupyter Notebooks .
3737
3838 Examples
3939 --------
4040 To easily use the library, you can use the command line interface. For
4141 example, to generate a .json file from a .ork file, you can use the
42- following command:
42+ following command on your terminal :
4343 >>> ork2json("rocket.ork", "rocket", "motor.eng")
4444
4545 If you want to use the library with Python, you can import the library and
4646 use the functions directly. For example, to generate a .json file from a
4747 .ork file, you can use the following code:
4848
4949 >>> from rocketserializer import ork2json
50- >>> ork2json("rocket.ork", "rocket", "motor.eng")
51-
52- If you want to convert a .ork file to a .py file, you can use the following
53- command:
54-
55- >>> serializer ork2py("rocket.ork", "rocket", "motor.eng")
50+ >>> ork2json([ "--filepath", "rocket.ork", "--eng", "motor.eng"])
5651
57- Finally, if you want to convert a .ork file to a .ipynb file, you can use:
52+ If you want to convert a .ork file to a Jupyter Notebook, you can use the
53+ following command on your terminal:
5854
59- >>> serializer ork2ipynb ("rocket.ork", "rocket", "motor.eng")
55+ >>> ork2notebook ("rocket.ork", "rocket", "motor.eng")
6056 """
6157
6258
@@ -67,13 +63,6 @@ def cli():
6763@click .option (
6864 "--output" , type = click .Path (), required = False , help = "The path to the output folder."
6965)
70- @click .option (
71- "--eng" ,
72- type = str ,
73- default = None ,
74- required = False ,
75- help = "The path to the .eng file, if necessary." ,
76- )
7766@click .option (
7867 "--ork_jar" ,
7968 type = click .Path (),
@@ -83,9 +72,7 @@ def cli():
8372)
8473@click .option ("--encoding" , type = str , default = "utf-8" , required = False )
8574@click .option ("--verbose" , type = bool , default = False , required = False )
86- def ork2json (
87- filepath , output = None , eng = None , ork_jar = None , encoding = "utf-8" , verbose = False
88- ):
75+ def ork2json (filepath , output = None , ork_jar = None , encoding = "utf-8" , verbose = False ):
8976 """Generates a .json file from the .ork file.
9077 The .json file will be generated in the output folder using the information
9178 of the .ork file. It is possible to specify the .eng file to extract the
@@ -98,10 +85,6 @@ def ork2json(
9885 The path to the .ork file.
9986 output : str
10087 The path to the output folder.
101- eng : str, optional
102- The path to the .eng file. If unspecified, the thrust curve will be
103- extracted from the .ork file. If specified, the thrust curve will be
104- extracted from the .eng file.
10588 ork_jar : str, optional
10689 The path to the OpenRocket .jar file. If unspecified, the .jar file
10790 will be searched in the current directory.
@@ -194,7 +177,6 @@ def ork2json(
194177 filepath = str (filepath ),
195178 output_folder = output ,
196179 ork = ork ,
197- eng = eng ,
198180 )
199181
200182 with open (
@@ -213,12 +195,13 @@ def ork2json(
213195 )
214196
215197
216- @cli .command ("ork2ipynb " )
198+ @cli .command ("ork2notebook " )
217199@click .option ("--filepath" , type = str , required = True )
218200@click .option ("--output" , type = str , required = False )
219- @click .option ("--eng" , type = str , default = None , required = False )
220201@click .option ("--ork_jar" , type = str , default = None , required = False )
221- def ork2ipynb (filepath , output , eng = None , ork_jar = None ):
202+ @click .option ("--encoding" , type = str , default = "utf-8" , required = False )
203+ @click .option ("--verbose" , type = bool , default = False , required = False )
204+ def ork2notebook (filepath , output , ork_jar = None , encoding = "utf-8" , verbose = False ):
222205 """Generates a .ipynb file from the .ork file.
223206
224207 Notes
@@ -233,10 +216,12 @@ def ork2ipynb(filepath, output, eng=None, ork_jar=None):
233216 filepath ,
234217 "--output" ,
235218 output ,
236- "--eng" ,
237- eng ,
238219 "--ork_jar" ,
239220 ork_jar ,
221+ "--encoding" ,
222+ encoding ,
223+ "--verbose" ,
224+ verbose ,
240225 ],
241226 standalone_mode = True ,
242227 )
0 commit comments