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

CAMS update: extended coverage and new error message handling #1799

Closed
AdamRJensen opened this issue Jul 1, 2023 · 0 comments · Fixed by #1905
Closed

CAMS update: extended coverage and new error message handling #1799

AdamRJensen opened this issue Jul 1, 2023 · 0 comments · Fixed by #1905

Comments

@AdamRJensen
Copy link
Member

AdamRJensen commented Jul 1, 2023

There are a few upcoming changes happening to the CAMS Radiation Service (below is a quote from an email sent out on June 30th 2023):

• The CAMS Radiation Service for HIMAWARI satellite field of view is now open in beta test.
• New error messages for CAMS Radiation and McClear services that can affect your acquisition routine. More details in the relase note below.
See the complete release note at: https://www.soda-pro.com/help/cams-services/release-notes-cams#2023-07-03

This is exciting news in that CAMS will now also be covering Asia and Australia in addition to the current coverage of Europe and Africa!

New error messages
As stated above, the team is also making changes to the error messages, which will require an update to the pvlib get_cams function. Based on the beta version, it seems the API now raises an HTTP error when encountering invalid requests. Previously the status was always 200 (OK), and the error message had to be manually detected using these lines:

# Invalid requests returns an XML error message and the HTTP staus code 200
# as if the request was successful. Therefore, errors cannot be handled
# automatic (e.g. res.raise_for_status()) and errors are handled manually
if res.headers['Content-Type'] == 'application/xml':
errors = res.text.split('ows:ExceptionText')[1][1:-2]
raise requests.HTTPError(errors, response=res)

The beta API can be tried out by manually specifying the URL:

data, meta = pvlib.iotools.get_cams(
    latitude=-24.98,
    longitude=118.60,
    start=pd.Timestamp('2020-01-01'),
    end=pd.Timestamp('2020-01-02'),
    email='redacted',
    server='vhost5.soda-is.com',
)

Solution
The above lines should be substituted by something along the lines of:

if not res.ok:
    res.raise_for_status()

A big thanks goes out to the CAMS team!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant