{"id":19528179,"url":"https://github.com/pucklaj/dynareadout_python","last_synced_at":"2025-04-26T11:33:00.608Z","repository":{"id":65528056,"uuid":"573950531","full_name":"PucklaJ/dynareadout_python","owner":"PucklaJ","description":"Python package of dynareadout for uploading to PyPI","archived":false,"fork":false,"pushed_at":"2024-07-24T08:15:00.000Z","size":241,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-24T09:43:19.180Z","etag":null,"topics":["binout","cae","d3plot","dyna","keyfile","ls-dyna","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PucklaJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-03T23:55:47.000Z","updated_at":"2024-07-24T08:14:52.000Z","dependencies_parsed_at":"2023-02-15T08:16:03.110Z","dependency_job_id":"227cfc2a-0821-4acc-b4df-47ffc5480671","html_url":"https://github.com/PucklaJ/dynareadout_python","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PucklaJ%2Fdynareadout_python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PucklaJ%2Fdynareadout_python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PucklaJ%2Fdynareadout_python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PucklaJ%2Fdynareadout_python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PucklaJ","download_url":"https://codeload.github.com/PucklaJ/dynareadout_python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224032115,"owners_count":17244373,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["binout","cae","d3plot","dyna","keyfile","ls-dyna","python"],"created_at":"2024-11-11T01:17:53.050Z","updated_at":"2024-11-11T01:17:53.988Z","avatar_url":"https://github.com/PucklaJ.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynareadout\n\nHigh-Performance and Thread-Safe C/C++ library for parsing binary output files and key files of LS Dyna (d3plot, binout, input deck) with bindings for python.\n\n## Documentation\n\nYou can find a [Wiki](https://github.com/PucklaJ/dynareadout/wiki) with API Documentation for python.\n\n## Examples\n\n### Binout\n\n```python\nfrom dynareadout import Binout\n\nbin_file = None\ntry:\n  # This library also supports opening multiple binout files at once by globing them\n  bin_file = Binout(\"path/to/your/binout*\")\nexcept RuntimeError as e:\n  print(\"Failed to open binout: {}\".format(e))\n  exit(1)\n\n# Print the children of the binout\nchildren = bin_file.read()\nfor (i, child) in enumerate(children):\n  print(\"Child {}: {}\".format(i, child))\n\n# Read some data. This method can read variables of all different types\nnode_ids = bin_file.read(\"nodout/ids\")\nfor i in range(len(node_ids)):\n  print(\"Node ID {}: {}\".format(i, node_ids[i]))\n\n# You can also find out if a variable exists\nnode_ids_exist = bin_file.variable_exists(\"nodout/ids\")\n\n# Get the number of time steps in the binout\nnodout_timesteps = bin_file.get_num_timesteps(\"nodout\")\n# The time steps can vary inside the binout\nrcforc_timesteps = bin_file.get_num_timesteps(\"rcforc\")\n\n# If you want to read \"timed\" data (x_displacement, x_force, etc.) you can do so also with the read method\nx_displacement = bin_file.read(\"nodout/x_displacement\")\nfor (t, time_step) in enumerate(x_displacement):\n  for (n, x_disp) in enumerate(time_step):\n    print(\"X Displacement time_step={}, node_id={}: {}\".format(t, node_ids[n], x_displacement[t][n]))\n```\n\n### D3plot\n\n```python\nfrom dynareadout import D3plot\n\nplot_file = None\ntry:\n  # Just give it the first d3plot file and it opens all of them\n  plot_file = D3plot(\"path/to/your/d3plot\")\nexcept RuntimeError as e:\n  print(\"Failed to open: {}\".format(e))\n  exit(1)\n\n# Read the title\ntitle = plot_file.read_title()\nprint(\"Title: {}\".format(title))\n\n# Read node ids\nnode_ids = plot_file.read_node_ids()\nprint(\"Nodes: {}\".format(len(node_ids)))\nfor (i, nid) in enumerate(node_ids):\n  print(\"Node {}: {}\".format(i, nid))\n\n# Read node coordinates of time step 10\nnode_coords = plot_file.read_node_coordinates(10)\nfor i in range(len(node_coords)):\n  print(\"Node Coords {}: ({:.2f}, {:.2f}, {:.2f})\".format(i, node_coords[i][0], node_coords[i][1], node_coords[i][2]))\n```\n\n### KeyFile\n\n```python\nfrom dynareadout import key_file_parse\n\nkeywords = key_file_parse(\"path/to/your/input.k\")\n\n# Parse all nodes\nnode_keywords = keywords[\"NODE\"]\n\n# Loop over all *NODE keywords\nfor i in range(len(node_keywords)):\n  # Loop over all cards of each *NODE keyword\n  for j in range(len(node_keywords[i])):\n    node = node_keywords[i][j]\n    # Then you can parse the variables of each card as integers and floats\n    # The list of integers holds all the widths of each variable in the card in characters\n    nid, x, y, z = node.parse_whole([8, 16, 16, 16])\n\n    print(f\"NODE {nid:d}: ({x:.3f}; {y:.3f}; {z:.3f})\")\n```\n\n## Other languages\n\nThis library is also available for C and C++ this version can be found [here](https://github.com/PucklaJ/dynareadout).\n\n## Installation\n\n```console\npython -m pip install dynareadout\n```\n\n## Uploading to PyPI\n\n1. Make sure that the dynareadout submodule has the correct version\n\n2. Update the version in `setup.py` and `pyproject.toml`. Also check if new source files have been added\n\n3. Publish a new release\n\n4. Create source distribution\n\n```console\npython setup.py sdist\n```\n5. Upload to `test.pypi.org`\n\n```console\npython -m twine upload --repository testpypi dist/*\n```\n\nThen insert `__token__` as username and the token as password.\n\n6. Install package from `test.pypi.org` to test it\n\n```console\npython -m pip install --upgrade --no-build-isolation --index-url https://test.pypi.org/simple/ dynareadout\n```\n\n7. If it works upload it to `pypi.org`\n\n8. Create windows wheel\n\n```console\npython -m build\n```\n\n9. Upload windows wheel to `test.pypi.org` and test it.\n\n10. If it works upload it to `pypi.org`\n\n```console\npython -m twine upload dist/*\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpucklaj%2Fdynareadout_python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpucklaj%2Fdynareadout_python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpucklaj%2Fdynareadout_python/lists"}