-
Notifications
You must be signed in to change notification settings - Fork 30
Support for local tables in separated directory from root dir #41
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
Conversation
ywangd
left a comment
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.
Mostly looking good. I have some minor comments that I'd appreciate if they can be addressed. Thanks!
pybufrkit/__init__.py
Outdated
|
|
||
| ap.add_argument('-l', '--tables-local-directory', | ||
| help='The directory to locate local BUFR tables', | ||
| default=None) |
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.
Nit: default=None is redundant
pybufrkit/__init__.py
Outdated
|
|
||
| ap.add_argument('-p', '--tables-local-provider', | ||
| help='The provider for local BUFR tables', | ||
| default=None) |
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.
Same here
pybufrkit/__init__.py
Outdated
|
|
||
| ns.tables_local_directory = ns.tables_local_directory or ns.tables_root_directory | ||
| if ns.tables_local_provider: | ||
| ns.tables_local_directory = ns.tables_local_directory + "/" + ns.tables_local_provider |
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.
Let's use os.path.join(...) since it handles different path separator on different platforms.
pybufrkit/coder.py
Outdated
|
|
||
| self.section_configurer = SectionConfigurer(definitions_dir=definitions_dir) | ||
| self.tables_root_dir = tables_root_dir or DEFAULT_TABLES_DIR | ||
| self.tables_local_dir = tables_local_dir or tables_root_dir |
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.
I think this should be
| self.tables_local_dir = tables_local_dir or tables_root_dir | |
| self.tables_local_dir = tables_local_dir or self.tables_root_dir |
Otherwise it could still be None.
|
I will rebase and do the requested changes later today.
…On Sat, Mar 22, 2025, 02:47 Yang Wang ***@***.***> wrote:
***@***.**** commented on this pull request.
Mostly looking good. I have some minor comments that I'd appreciate if
they can be addressed. Thanks!
------------------------------
In pybufrkit/__init__.py
<#41 (comment)>:
> @@ -62,6 +62,14 @@ def main():
ap.add_argument('-t', '--tables-root-directory',
help='The directory to locate BUFR tables')
+ ap.add_argument('-l', '--tables-local-directory',
+ help='The directory to locate local BUFR tables',
+ default=None)
Nit: default=None is redundant
------------------------------
In pybufrkit/__init__.py
<#41 (comment)>:
> @@ -62,6 +62,14 @@ def main():
ap.add_argument('-t', '--tables-root-directory',
help='The directory to locate BUFR tables')
+ ap.add_argument('-l', '--tables-local-directory',
+ help='The directory to locate local BUFR tables',
+ default=None)
+
+ ap.add_argument('-p', '--tables-local-provider',
+ help='The provider for local BUFR tables',
+ default=None)
Same here
------------------------------
In pybufrkit/__init__.py
<#41 (comment)>:
> @@ -261,6 +269,10 @@ def main():
ns = ap.parse_args()
+ ns.tables_local_directory = ns.tables_local_directory or ns.tables_root_directory
+ if ns.tables_local_provider:
+ ns.tables_local_directory = ns.tables_local_directory + "/" + ns.tables_local_provider
Let's use os.path.join(...) since it handles different path separator on
different platforms.
------------------------------
In pybufrkit/coder.py
<#41 (comment)>:
>
self.section_configurer = SectionConfigurer(definitions_dir=definitions_dir)
self.tables_root_dir = tables_root_dir or DEFAULT_TABLES_DIR
+ self.tables_local_dir = tables_local_dir or tables_root_dir
I think this should be
⬇️ Suggested change
- self.tables_local_dir = tables_local_dir or tables_root_dir
+ self.tables_local_dir = tables_local_dir or self.tables_root_dir
Otherwise it could still be None.
—
Reply to this email directly, view it on GitHub
<#41 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABR6CQTBGGS56JUA5SUL5GT2VS6JZAVCNFSM6AAAAABZFMVF5KVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDOMBXGYZDIMBXGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
47bcd9d to
d269d89
Compare
d269d89 to
c0dd176
Compare
|
I made the changes and force-pushed it to my branch. |
ywangd
left a comment
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.
Thanks. Looks good to me. I'll be merging this.
Behavior change on command line tool:
New command line switches:
-l -> Path for local tables
-p -> Provider of local table
The user can select a separate path and provider for local tables.
Behavior change on library:
A new parameter was added to Encode and Decode classes:
tables_local_dir: Path to search for local tables. Default is the same value astables_root_dir. Here the path should already contain theproviderof the table.Suggest directory structure: