How to add epw file to artifacts as part of Payload to Pollination using Rest API

Hi guys,

I was wondering if someone could guide me with this. I am trying to send an annual daylight recipe as part of a payload to pollination using the API, however I don’t think I am understanding ‘where’ the epw file gets adding to the set of artifacts in the payload. Or is this even the way to do it? Below you will see the sequence of .hbjsons that get uploaded as well as the .epw, but the response still seems to say that the wea file is missing…

{'detail': 'Conflict: Project already exists'}
{'owner': 'ladybug-tools', 'name': 'annual-daylight', 'tag': '0.8.7-viz'}
['shoe-box_width5.0_height3.7_depth5.0_wwr0.4.hbjson', 'shoe-box_width5.5_height3.8_depth5.5_wwr0.4.hbjson', 'shoe-box_width4.5_height3.6_depth4.5_wwr0.4.hbjson', 'shoe-box_width4.0_height3.5_depth4.0_wwr0.4.hbjson', 'Copenhagen_dry_Danmark_2013.epw']
{'file': ('models/honeybee-json-files/shoe-box_width5.0_height3.7_depth5.0_wwr0.4.hbjson',
          <_io.BufferedReader name='models/honeybee-json-files/shoe-box_width5.0_height3.7_depth5.0_wwr0.4.hbjson'>)}
<Response [204 No Content]>
{'file': ('models/honeybee-json-files/shoe-box_width5.5_height3.8_depth5.5_wwr0.4.hbjson',
          <_io.BufferedReader name='models/honeybee-json-files/shoe-box_width5.5_height3.8_depth5.5_wwr0.4.hbjson'>)}
<Response [204 No Content]>
{'file': ('models/honeybee-json-files/shoe-box_width4.5_height3.6_depth4.5_wwr0.4.hbjson',
          <_io.BufferedReader name='models/honeybee-json-files/shoe-box_width4.5_height3.6_depth4.5_wwr0.4.hbjson'>)}
<Response [204 No Content]>
{'file': ('models/honeybee-json-files/shoe-box_width4.0_height3.5_depth4.0_wwr0.4.hbjson',
          <_io.BufferedReader name='models/honeybee-json-files/shoe-box_width4.0_height3.5_depth4.0_wwr0.4.hbjson'>)}
<Response [204 No Content]>
{'file': ('models/wea-files/Copenhagen_dry_Danmark_2013.epw',
          <_io.BufferedReader name='models/wea-files/Copenhagen_dry_Danmark_2013.epw'>)}
<Response [204 No Content]>
{'detail': [{'loc': ['arguments', 0], 'msg': 'missing required argument wea', 'type': 'value_error'}, {'loc': ['arguments', 1], 'msg': 'missing required argument wea', 'type': 'value_error'}, {'loc': ['arguments', 2], 'msg': 'missing required argument wea', 'type': 'value_error'}, {'loc': ['arguments', 3], 'msg': 'missing required argument wea', 'type': 'value_error'}, {'loc': ['arguments', 4], 'msg': 'missing required argument wea', 'type': 'value_error'}]}
Traceback (most recent call last):
  File "/Users/karimdaw/Projects/pollination-app/src/call_pollination.py", line 75, in <module>
    job_id = res.json()['id']
KeyError: 'id'

Maybe if someone could give me an example of how to organize sending the required files for an annual daylight recipe to pollination using the API that would be awesome

Here is a link to the script. pollination-app/call_pollination.py at 0464fd6d5e7ce2c51be043fedc230f6bf3909d7b · karim-daw/pollination-app · GitHub

1 Like

following as am about to endeavor down this path myself and get into the nitty gritty working with the API.
Also: will probably be getting some things setup over the weekend so if writes answer to question: will link to here

1 Like

Hi @karimdaw! Thank you for sharing the link to your script.

Here are some comments from looking at your code and without trying to run it.

When you create a project you should set public to True. The starter Beta account doesn’t give you the option for creating private projects. :point_down:

From what I can see in your wea-files folder you have an epw and not a wea file. The annual daylight recipe needs a wea file as an input. You can see the list of inputs here. Only the model and wea inputs are required.

That’s why you get this error: missing required argument wea - You need to pass a wea file for the wea input argument.

Hope it helps!

2 Likes

2 posts were split to a new topic: Create a Wea file from an EPW file using Ladybug SDK