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

Error if no reference time specified/found #55

Open
cemaccam opened this issue Mar 12, 2024 · 4 comments
Open

Error if no reference time specified/found #55

cemaccam opened this issue Mar 12, 2024 · 4 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@cemaccam
Copy link
Collaborator

Currently, if no reference time is specified at command line, and if config.yml specifies that CFizer should look for it in an input file but cannot find one, the program exits with the following error (when running on a single process):
process_serial (cfize+save): 'NoneType' object has no attribute 'calendar'

The program should instead fail before starting processing, in the absence of a reference date.

@cemaccam cemaccam added the bug Something isn't working label Mar 12, 2024
@cemaccam
Copy link
Collaborator Author

cemaccam commented Mar 12, 2024

The ideal place to add a check for reference time, and exit if it doesn't exist, would be immediately prior to

g.update(
        {
            "time_units": time_units,
            "logfile": f'cfizer_{datetime.now().isoformat(sep="_", timespec="minutes").replace(":", "")}.log',
        }
    )

(line 1254) in cfize.py.

@sjboeing
Copy link
Collaborator

You are a hero Cameron. I will keep you posted (submitting some proposals next week but will try to give this a go).

@sjboeing
Copy link
Collaborator

sjboeing commented Apr 4, 2024

I got it to work (figured I had copied the wrong file for the inputs). Happy to merge PR #42, @cemaccam. Would it be OK to make the repository publicly visible. I will get in touch with Paul Barrett but also mention the caveat that it requires files formatted in a specific way,

@cemaccam
Copy link
Collaborator Author

cemaccam commented Apr 4, 2024

Glad you got it working, @sjboeing . If PR #42 is working ok, it can be merged, but will need some care, to incorporate changes made to Main since.
Regarding visibility, I'm fine with it, but suggest you check in with @MarkUoLeeds and @AnneBarber1 first. @AnneBarber1 has added some notes to the readme to make it clearer how to ensure correct functioning.
In the long term, if this work continues, I think it would be worth taking the slight performance hit to better compartmentalise the various functions - fully separate the dataset-wrangling (merging, splitting, and associated metadata changes) from CF-compliance functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants