-
Notifications
You must be signed in to change notification settings - Fork 14
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
MdbClasses using radis.api #272
Conversation
included #273 |
In my environment,
↓
Note that I did the following in the radis directory cloned from github.
|
Hello, it may be because you require a different Radis branch than the develop version. Can you checkout the |
Thank you very much for the suggestion Erwan, but I already checked out the common-api branch. |
The problem was the existence of hdf5 files created in the past (by previous version of mdb modules). The error was solved by deleting the relevant file from the .database. |
For example,
↓
Please note that "/home/tako/ghR/exojax/tests/.database/CO/05_HITEMP2019/CO-05_HITEMP2019.hdf5" does indeed exist. |
super().__init__( | ||
molecule=self.simple_molecule_name, | ||
name="HITEMP-{molecule}", | ||
local_databases=self.path.parent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewriting this line with
local_databases="/",
looks resolve the above error for MdbHitemp
.
Is it ok?
super().__init__( | ||
molecule=self.simple_molecule_name, | ||
name="HITRAN-{molecule}", | ||
local_databases=self.path.parent, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In contrast, rewriting this line to local_databases="/",
still left MdbHitran
with a PermissionError as below.
from exojax.spec.api import MdbHitran
mdb = MdbHitran(".database/CO/05_hit12.par", nurange=[4200.0, 4300.0], crit=1.e-30)
↓
---------------------------------------------------------------------------
PermissionError Traceback (most recent call last)
/tmp/ipykernel_4125346/607486000.py in <module>
1 from exojax.spec.api import MdbHitran
----> 2 mdb = MdbHitran(".database/CO/05_hit12.par",
3 nurange=[4200.0, 4300.0],
4 crit=1.e-30)
~/miniconda3/lib/python3.9/site-packages/exojax-1.1.3-py3.9.egg/exojax/spec/api.py in __init__(self, path, nurange, margin, crit, Ttyp, isotope, gpu_transfer)
502 download_files = self.get_missing_files(local_file)
503 if download_files:
--> 504 self.download_and_parse(download_files,
505 cache=True,
506 parse_quanta=True)
~/miniconda3/lib/python3.9/site-packages/radis-0.13.0-py3.9-linux-x86_64.egg/radis/api/hitranapi.py in download_and_parse(self, local_file, cache, parse_quanta)
1183 # Use HAPI only to download the files, then we'll parse them with RADIS's
1184 # parsers, and convert to RADIS's fast HDF5 file formats.
-> 1185 isotope_list, data_file_list, header_file_list = download_all_hitran_isotopes(
1186 molecule, tempdir
1187 )
~/miniconda3/lib/python3.9/site-packages/radis-0.13.0-py3.9-linux-x86_64.egg/radis/api/hitranapi.py in download_all_hitran_isotopes(molecule, directory)
1141 from radis.misc.basics import make_folders
1142
-> 1143 make_folders(*split(abspath(directory)))
1144
1145 db_begin(directory)
~/miniconda3/lib/python3.9/site-packages/radis-0.13.0-py3.9-linux-x86_64.egg/radis/misc/basics.py in make_folders(path, folders)
37 folders = [folders]
38 for folder in folders:
---> 39 os.makedirs(
40 join(path, folder), exist_ok=True
41 ) # makedirs create folders recursively
~/miniconda3/lib/python3.9/os.py in makedirs(name, mode, exist_ok)
213 if head and tail and not path.exists(head):
214 try:
--> 215 makedirs(head, exist_ok=exist_ok)
216 except FileExistsError:
217 # Defeats race condition when another thread created the path
~/miniconda3/lib/python3.9/os.py in makedirs(name, mode, exist_ok)
223 return
224 try:
--> 225 mkdir(name, mode)
226 except OSError:
227 # Cannot rely on checking for EEXIST, since the operating system
PermissionError: [Errno 13] Permission denied: '/downloads__can_be_deleted'
@chonma0ctopus your error messages refer to Radis 0.13 in the python site-packages. I think that maybe, you have two Radis on your computer. The one cloned and another one installed by pip.
(dont forget the dot) Edit : actually the public version doesn't have hitranapi.py. So you're using the right version and the error is somewhere else |
@chonma0ctopus I've been looking into your problem. It requires some decisions. We'll need @HajimeKawahara input too. Basically the question is how should you identify a database. In ExoJax, the user specifies the path of the database file. The file is downloaded if it doesn't exist. The name of the molecule is infered from the database file. Do you want to keep ExoJax as it currently is ? For instance, if computing a new molecule; let's say acetylene C2H2, what would be the user script (and how does the user find it ) ? On top of that, Radis currently systematically registers all files into the ~/radis.json config file. Although I find it convenient, I think it's a Radis-specific feature that shouldn't be forced to other codes, and so it should not be included in the common-API. Some of your current errors are due to the common API trying to read from this file. We'll remove this. The easiest option is probably a "register_database" boolean which would be False by default, and True only in Radis. I also pushed some changes to radis/common-api related to relative/absolute path, it might help. Please pull . |
@erwanp @chonma0ctopus In our field, we frequently examine the differences in results between databases. This is because some molecules are detected in the new database while they were not detected in the old database. That's why ExoJAX specifies the database file directly. |
@erwanp Thank you for looking into the problem and fixing it. I no longer get the ValueError and PermissionError reported earlier. One thing that still bothers me a little is that the code
still raises a ValueError below:
After deleting the
circumvents the error. There seems to be some trouble with case sensitivity? Regarding the database identification, I would also prefer to retain both option of the database designation and the molecular name designation, if possible. |
Hello thanks for the explanation. Then we'll make sure that the common-api does not require (it will be optional) the molecule name, and the registration, and therefore no radis.json. I can have a look next weekend |
Add/common api for ExoJax/Radis HajimeKawahara/exojax#272
Confirmed to work with radis / |
Great! I can publish RADIS 0.14 which will include the changes. |
That's nice! I'm gonna set up CI using |
I made api.py that uses radis.api (common api prototype, see #256 #257 ) as ExoMol, HITEMP, HITRAN database I/O.
This capability currently needs to install radis common-api branch.
@erwanp
After resolving this PR, should we merge
[common-api branch](https://github.com/radis/radis/tree/add/common-api)
todevelop
branch in radis? or any other solution?