cal-adapt / climakitae

A Python toolkit for retrieving, visualizing, and performing scientific analyses with data from the Cal-Adapt Analytics Engine.
https://climakitae.readthedocs.io
BSD 3-Clause "New" or "Revised" License
19 stars 2 forks source link

Bug fix on TMY: elevation in export #326

Closed vicford closed 6 months ago

vicford commented 6 months ago

Description of PR

Summary of changes and related issue Previously, TMY file export was breaking on using an API requests call to the EPQS DEM to obtain elevation. As far as I can tell, this is on the EPQS side of things and not on our code base. To address this, I added the corresponding elevation values from wecc-station csv to the hadisd_stations csv file that is used in the climakitae backend, and modified the TMY code to obtain the corresponding elevation value when requested. At present, when a custom location is passed, elevation is set to 0. This will be a future fix.

Relevant motivation and context

Dependencies required for this change? N/A

Fixes # (issue), delete if not necessary

Type of change

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. To test, please run the TMY notebook and ensure that both .tmy and .epw files are produced

Checklist:

Tianchi-Liu commented 6 months ago

I understand that fix is on the way, but I wonder if it makes sense for TMY to have -9999 elevations when custom locations are passed. Or another value that cannot be mistaken as actual elevation. Just a thought!

vicford commented 6 months ago

I understand that fix is on the way, but I wonder if it makes sense for TMY to have -9999 elevations when custom locations are passed. Or another value that cannot be mistaken as actual elevation. Just a thought!

This is a great point @Tianchi-Liu - the official EPW documentation states the range of acceptable elevation is -1000 to 9999.9, with a default value of 0.0. They don't have a rule for missing value for elevation, and I suspect that if a value is missing in the header file, the analysis program fails to run. I think for the time being it is okay to use the default value as a stop gap, and perhaps incorporate an optional argument with markdown explaining that if a custom location is passed the user must provide the elevation value or it will default to 0

claalmve commented 6 months ago

Ran TMY export and generation looks good to me with the change in deriving elevation. Nice job finding a fix so quickly!