-
-
Notifications
You must be signed in to change notification settings - Fork 208
Closed
Labels
EnhancementNew feature or request, including adjustments in current codesNew feature or request, including adjustments in current codes
Milestone
Description
Is your feature request related to a problem? Please describe.
Exporting rocketpy classes to a json file is something that the user currently cannot do so easily.
The get_instance_attributes (see below) function already made an important advance to export all the attributes of an instance to a dictionary, but that doesn't mean we can always save these dictionaries to json files.
Exporting objects as json files might be the easiest way of saving a rocketpy simulation without having to plot tons of data and plots.
RocketPy/rocketpy/utilities.py
Line 642 in 14dd0f6
| def get_instance_attributes(instance): |
Describe the solution you'd like
- Add
to_json,to_serializableor__json__methods to the important classes of RocketPy, allowing the - Alternatively, the
jsonpicklepackage can be used to perform a quick encode/decode with any of the rocketpy classes, as already done in the EnvironmentAnalysis class.
def save(self, filename="env_analysis_dict"):
Additional context
As far as I know there's no convention on Python regarding the name of the method
Metadata
Metadata
Assignees
Labels
EnhancementNew feature or request, including adjustments in current codesNew feature or request, including adjustments in current codes
Type
Projects
Status
Closed