sunfluidh:python_read_sunfluidh_files
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
sunfluidh:python_read_sunfluidh_files [2024/02/01 11:54] – yann | sunfluidh:python_read_sunfluidh_files [2024/04/25 09:40] (Version actuelle) – yann | ||
---|---|---|---|
Ligne 14: | Ligne 14: | ||
<file txt fct_readsunfluidhdata.py> | <file txt fct_readsunfluidhdata.py> | ||
+ | |||
# | # | ||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||
Ligne 19: | Ligne 20: | ||
# | # | ||
# Author | # Author | ||
- | # date : July 2020 | + | # date : July 2020 - last release : May 2022 |
# comments : Function to read the binary data provided by the code SUNFLUIDH | # comments : Function to read the binary data provided by the code SUNFLUIDH | ||
# | # | ||
Ligne 39: | Ligne 40: | ||
# - Velocity components can be easily placed at the cell-centers (as scalar quantities). | # - Velocity components can be easily placed at the cell-centers (as scalar quantities). | ||
# For that, set flag_center= True (see the example at the end) | # For that, set flag_center= True (see the example at the end) | ||
+ | # | ||
# | # | ||
Ligne 64: | Ligne 65: | ||
# | # | ||
+ | def _ExistingFileList (dir_name, | ||
+ | """ | ||
+ | Check te existence of the access path to dataa, the existence of files related to the type of data | ||
+ | List the present files | ||
+ | |||
+ | Args IN : | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | """ | ||
+ | |||
+ | #--- Directory exists ? | ||
+ | |||
+ | if os.path.exists(dir_name) : | ||
+ | print(" | ||
+ | else : | ||
+ | print(" | ||
+ | print(" | ||
+ | exit () | ||
+ | |||
+ | if dset_type == _lst_filetype[0] : | ||
+ | root=" | ||
+ | elif dset_type == _lst_filetype[1] : | ||
+ | root=" | ||
+ | elif dset_type == _lst_filetype[2] : | ||
+ | root=" | ||
+ | else : | ||
+ | print(" | ||
+ | print(" | ||
+ | print(" | ||
+ | exit () | ||
+ | |||
+ | os.chdir(dir_name) | ||
+ | | ||
+ | return sorted(glob.glob(root)) | ||
+ | |||
+ | # | ||
+ | # | ||
def _BuildDataAccess (dset_type, | def _BuildDataAccess (dset_type, | ||
Ligne 118: | Ligne 159: | ||
return data_access, | return data_access, | ||
+ | |||
# | # | ||
# | # | ||
Ligne 233: | Ligne 274: | ||
# | # | ||
- | dt_int32=np.dtype('> | + | dt_int32=np.dtype('> |
dt_int64=np.dtype('> | dt_int64=np.dtype('> | ||
dt_flt32=np.dtype('> | dt_flt32=np.dtype('> | ||
Ligne 249: | Ligne 290: | ||
file_info[' | file_info[' | ||
# | # | ||
+ | |||
# | # | ||
#--- Extract the data location (useless data at present) | #--- Extract the data location (useless data at present) | ||
Ligne 356: | Ligne 397: | ||
#--- Velocity location at the cell-centre | #--- Velocity location at the cell-centre | ||
+ | |||
if flag_centered_vel and not file_info[' | if flag_centered_vel and not file_info[' | ||
_CenteredVelocity (fieldname=fieldname, | _CenteredVelocity (fieldname=fieldname, | ||
Ligne 460: | Ligne 502: | ||
Check_Dict (title= " | Check_Dict (title= " | ||
+ | |||
</ | </ |
sunfluidh/python_read_sunfluidh_files.txt · Dernière modification : 2024/04/25 09:40 de yann