Skip to content
This repository was archived by the owner on Jan 18, 2023. It is now read-only.

Unexpected behavior when using AAL.get_summary() with extra parameters #70

Open
JoakimWeill opened this issue Aug 4, 2021 · 2 comments
Labels
question Further information is requested

Comments

@JoakimWeill
Copy link

Hi,

I am having trouble understanding differences in the behavior of the aal API depending on whether specific depths parameters are provided.

For instance, without any depth parameter the following call returns an average annual loss of $59,207 for the mid scenario in 2020


fs_aal = fs.aal.get_summary(
                search_items=[110200183], 
                csv=True, 
                location_type="property",
                output_dir="output_data/",
                extra_param=None
                )
	fsid	     depth	damage	year	low	mid	high
1	110200183	3	8983	2020	57699	59207	60256
2	110200183	15	39930	2020	57699	59207	60256
3	110200183	31	81500	2020	57699	59207	60256
4	110200183	3	8983	2050	58223	59731	60780
5	110200183	15	39930	2050	58223	59731	60780
6	110200183	31	81500	2050	58223	59731	60780

However, when manually providing the 3 default depth values the mid aal value changes to $80,647 (although the damages associated with each depth level are consistent with the previous call)

fs_aal = fs.aal.get_summary(
                search_items=[110200183], 
                csv=True, 
                location_type="property",
                output_dir="output_data/",
                extra_param={"depths": [3,15,31]}
                )
	fsid	      depth	damage	year	low	mid	high
1	110200183	3	8983	2020	80647	80647	80647
2	110200183	15	39930	2020	80647	80647	80647
3	110200183	31	81500	2020	80647	80647	80647
4	110200183	3	8983	2050	80647	80647	80647
5	110200183	15	39930	2050	80647	80647	80647
6	110200183	31	81500	2050	80647	80647	80647

In fact, providing any positive value of the depth parameter yields aal values of 80,647. See example below with a depth of 1:


	fsid	      depth	damage	year	low	mid	high
1	110200183	1	3803	2020	80647	80647	80647
2	110200183	1	3803	2050	80647	80647	80647

This could still make sense if i) the property 110200183 is below sea-level, ii) the total value of the structure is $80,647, iii) and if the aal mid value actually reports the total damage estimate without probability weighting when the depth is provided. However using location.get_detail I find that the elevation for this property is a high 699. Is there something I am missing?

Thanks a lot for this fantastic API,

Jo

@JoakimWeill JoakimWeill added the question Further information is requested label Aug 4, 2021
@Lyetenth
Copy link
Contributor

Lyetenth commented Aug 6, 2021

Hi @JoakimWeill,

It looks like the issue is that the database is caching previous results. When you make your second call with extra_param={"depths": [3,15,31]}, it performs a recalculation and provides the correct values.

For now, please use this fix. We'll be looking into making adjustments to the caching to fix this issue

@JoakimWeill
Copy link
Author

Thanks for letting me know @Lyetenth, I'll add extra params to the requests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants