From 4fb2f877d63f89f54563da71e3c037530cda87a6 Mon Sep 17 00:00:00 2001 From: Diego Quintana Date: Fri, 8 Mar 2024 16:49:39 +0100 Subject: [PATCH] =?UTF-8?q?Resolve=20"Grafica=20Energia=20Exportada=20i=20?= =?UTF-8?q?PR=20-=20m=C3=A9s=20decimals"=20(et/somenergia-jardiner!135)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ref: remove rounding let the client do the rounding --- .../marts/dm_plant_production_monthly.sql | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/dbt_jardiner/models/jardiner/marts/dm_plant_production_monthly.sql b/dbt_jardiner/models/jardiner/marts/dm_plant_production_monthly.sql index b72bc19..9621103 100644 --- a/dbt_jardiner/models/jardiner/marts/dm_plant_production_monthly.sql +++ b/dbt_jardiner/models/jardiner/marts/dm_plant_production_monthly.sql @@ -9,26 +9,26 @@ select potencia_pic_kw as potencia_pic_kw, sum(energia_instantania_inversor_kwh) / 1000.0 as energia_instantania_inversor_mwh, count(energia_instantania_inversor_kwh) as energia_inversor_count, - round((sum(energia_exportada_instantania_comptador_kwh) / 1000.0)::numeric, 1) as energia_exportada_instantania_comptador_mwh, + (sum(energia_exportada_instantania_comptador_kwh) / 1000.0)::numeric as energia_exportada_instantania_comptador_mwh, count(energia_exportada_instantania_comptador_kwh) as energia_exportada_instantania_comptador_count, - round((sum(energia_exportada_comptador_kwh) / 1000.0)::numeric, 1) as energia_exportada_comptador_mwh, - round((sum(energia_importada_comptador_kwh) / 1000.0)::numeric, 1) as energia_importada_comptador_mwh, + (sum(energia_exportada_comptador_kwh) / 1000.0)::numeric as energia_exportada_comptador_mwh, + (sum(energia_importada_comptador_kwh) / 1000.0)::numeric as energia_importada_comptador_mwh, --min(data_prediccio) as data_prediccio, - round((sum(energia_predita_meteologica_kwh) / 1000.0)::numeric, 1) as energia_predita_meteologica_mwh, - round((sum(energia_esperada_solargis_kwh) / 1000.0)::numeric, 1) as energia_esperada_solargis_mwh, + (sum(energia_predita_meteologica_kwh) / 1000.0)::numeric as energia_predita_meteologica_mwh, + (sum(energia_esperada_solargis_kwh) / 1000.0)::numeric as energia_esperada_solargis_mwh, avg(preu_omie_eur_mwh) as preu_omie_eur_mwh, sum(irradiation_wh_m2) as irradiation_wh_m2, sum(irradiacio_satellit_wh_m2) as irradiacio_satellit_wh_m2, --avg(temperatura_modul_avg_c) as temperatura_modul_avg_c, - round((sum(energia_exportada_comptador_kwh / potencia_pic_kw) / (nullif(sum(irradiacio_satellit_wh_m2), 0.0) / 1000.0))::numeric, 3) as pr, - round((sum(energia_exportada_comptador_kwh) / potencia_pic_kw)::numeric, 2) as hores_equivalents, + (sum(energia_exportada_comptador_kwh / potencia_pic_kw) / (nullif(sum(irradiacio_satellit_wh_m2), 0.0) / 1000.0))::numeric as pr, + (sum(energia_exportada_comptador_kwh) / potencia_pic_kw)::numeric as hores_equivalents, sum(hora_disponible) as hora_disponible, sum(hora_total) as hora_total, sum(hora_disponible) / nullif(sum(hora_total), 0) as disponibilitat, - round((sum(energia_desviada_omie_kwh) / 1000.0)::numeric, 1) as energia_desviada_omie_mwh, - round((sum(abs(energia_desviada_omie_kwh_absolute)) / 1000.0)::numeric, 1) as energia_desviada_omie_mwh_absolute, {# should it be abs or we let compensate itself? #} - round((sum(energia_perduda_kwh) / 1000.0)::numeric, 1) as energia_perduda_mwh, - round((1 - sum(energia_predita_meteologica_kwh) / nullif(sum(energia_exportada_comptador_kwh), 0))::numeric, 2) as energia_desviada_percent + (sum(energia_desviada_omie_kwh) / 1000.0)::numeric as energia_desviada_omie_mwh, + (sum(abs(energia_desviada_omie_kwh_absolute)) / 1000.0)::numeric as energia_desviada_omie_mwh_absolute, {# should it be abs or we let compensate itself? #} + (sum(energia_perduda_kwh) / 1000.0)::numeric as energia_perduda_mwh, + (1 - sum(energia_predita_meteologica_kwh) / nullif(sum(energia_exportada_comptador_kwh), 0))::numeric as energia_desviada_percent from {{ ref("dm_plant_production_daily") }} group by date_trunc('month', dia), plant_uuid, nom_planta, tecnologia, potencia_pic_kw order by month desc