sunfluidh:python_read_sunfluidh_files
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
sunfluidh:python_read_sunfluidh_files [2024/02/01 11:48] – créée yann | sunfluidh:python_read_sunfluidh_files [2024/04/25 09:40] (Version actuelle) – yann | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | ===== PYTHON | + | ===== SUNFLUIDH FILE READER ===== |
----- | ----- | ||
Ligne 11: | Ligne 11: | ||
Information about these files can be found here ([[sunfluidh: | Information about these files can be found here ([[sunfluidh: | ||
+ | Information about the file reader is included in the following file. | ||
<file txt fct_readsunfluidhdata.py> | <file txt fct_readsunfluidhdata.py> | ||
+ | |||
# | # | ||
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||
Ligne 18: | 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 38: | 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 63: | 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 117: | Ligne 159: | ||
return data_access, | return data_access, | ||
+ | |||
# | # | ||
# | # | ||
Ligne 232: | 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 248: | Ligne 290: | ||
file_info[' | file_info[' | ||
# | # | ||
+ | |||
# | # | ||
#--- Extract the data location (useless data at present) | #--- Extract the data location (useless data at present) | ||
Ligne 355: | 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 459: | Ligne 502: | ||
Check_Dict (title= " | Check_Dict (title= " | ||
+ | |||
</ | </ |
sunfluidh/python_read_sunfluidh_files.1706784480.txt.gz · Dernière modification : 2024/02/01 11:48 de yann