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

Example of reading a Processing object from json #172

Open
kkappler opened this issue May 7, 2022 · 1 comment
Open

Example of reading a Processing object from json #172

kkappler opened this issue May 7, 2022 · 1 comment
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@kkappler
Copy link
Collaborator

kkappler commented May 7, 2022

With the new processing configs I am testing the functionality of writing to json (works fine) and reading from json (not working).

I created an outline of a test for this on branch dev in
aurora/test_utils/synthetic/make_processing_configs_new.py

The test is called test_to_from_json()

The output json is created, and it is read-in but something happens on line 659 of mt_metadata/mt_metadata/base/metadata.py on the call to self.from_dict(json_dict) .. maybe too many layers of nested dicts? The error message is pasted below

Traceback (most recent call last):
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 455, in set_attr_from_name
    helpers.recursive_split_setattr(self, name, value)
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/helpers.py", line 334, in recursive_split_setattr
    recursive_split_setattr(base_object, other[0], value)
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/helpers.py", line 334, in recursive_split_setattr
    recursive_split_setattr(base_object, other[0], value)
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/helpers.py", line 336, in recursive_split_setattr
    setattr(base_object, key, value)
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 334, in __setattr__
    super().__setattr__(name, value)
  File "/home/kkappler/software/irismt/aurora/aurora/config/metadata/station.py", line 45, in runs
    run.from_dict(item)
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 616, in from_dict
    self.set_attr_from_name(name, value)
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 466, in set_attr_from_name
    setattr(self, name, value)
  File "/home/kkappler/software/irismt/mt_metadata/mt_metadata/base/metadata.py", line 344, in __setattr__
    test_property.fset(self, value)
  File "/home/kkappler/software/irismt/aurora/aurora/config/metadata/run.py", line 100, in time_periods
    raise TypeError(f"not sure what to do with type {type(item)}")
TypeError: not sure what to do with type <class 'dict'>

Process finished with exit code 1
@kkappler kkappler added bug Something isn't working enhancement New feature or request labels May 7, 2022
@kkappler kkappler mentioned this issue May 13, 2022
Merged
38 tasks
kkappler added a commit that referenced this issue Jul 8, 2022
There is already a test to debug issue 172 specifically
set up in test_utils/synthetic/make_processing_configs.py

[Issue(s): #172]
@kkappler
Copy link
Collaborator Author

Configs are currently being saved during several of the synthetic tests.

  • Add a line to the synthetic tests that confirms we can read in the config
  • Confirm the ingested config can be used successfully for processing
  • remove test_to_from_json() from make_processing_configs.py

We can test

kkappler added a commit that referenced this issue Jan 23, 2023
- also put placeholder for testing issue #172 when it is solved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants