Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fea] Add save_tecplot_file #722

Merged

Conversation

HydrogenSulfate
Copy link
Collaborator

PR types

New features

PR changes

APIs

Describe

  1. 添加将数组保存至tecplot格式文件的功能
  2. 统一参数file_pathfilenamealias_dict的含义

Copy link

paddle-bot bot commented Dec 26, 2023

Thanks for your contribution!

@@ -42,11 +43,11 @@ def save_csv_file(
"""Write numpy data to csv file.

Args:
file_path (str): Dump file path.
filename (str): Dump file path.
data_dict (Dict[str, Union[np.ndarray, paddle.Tensor]]): Numpy data in dict.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numpy or Tensor data in dict.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

encoding: str = "utf-8",
num_timestamps: int = 1,
):
"""Write numpy data to tecplot file.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numpy or tensor data

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

keys (Tuple[str, ...]): Target keys to be dumped.
alias_dict (Optional[Dict[str, str]], optional): Alias dict for keys,
i.e. {dump_key: dict_key}. Defaults to None.
delimiter (str, optional): Delemiter for splitting different data field. Defaults to ",".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Defaults to " "

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改

for items in zip(*data_cur_time_step):
f.write(delimiter.join([str(float(x)) for x in items]) + "\n")

logger.message(f"csv file has been dumped to {dump_filename}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该是tec file吧

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修复

Copy link
Collaborator

@zhiminzhang0830 zhiminzhang0830 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhiminzhang0830 zhiminzhang0830 merged commit a57b3d8 into PaddlePaddle:develop Jan 2, 2024
3 checks passed
@HydrogenSulfate HydrogenSulfate deleted the add_tecplot_saver branch January 2, 2024 05:01
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
* add save_tecplot_file

* fix docstring

* update code

* update code

* refine code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants