Skip to main content

Tools to work with data inside BLCs MS Sharepoint Cloud & Database

Project description

BLC Data Analytics tools package

Data Analytics helper functions to work with inside BLC's Cloud system.

Changelog

Version 0.0.25

  • TablasVC()

    • Changed: modificar_incidencia() now doesn't affect .incidencias_todas_auditoria attribute.
  • DatosCROM()

    • Improved: .estimar_ENS_varias_incidencias()'s overall speed and precision. Still not good for production, but better for single WTG incidents.
    • Improved: Memory Usage overall
    • Removed : Pgen_U variable, was a duplicate of FC.
    • Removed: Pcon_U, Egen_U, Econ_U, Epos_U, very rarely useed, could be calculated by hand.
  • DatosCdO()

    • Added this new object to interact with InAccess' API and download raw data from Caldenes del Oeste solar PV Plant (CdO)
      • Initialization parameters:
      • usr = Username (SCADA's username)
      • pwd = PAssword (SCADA's password)
      • apikey = Private apikey provided from InAccess
      • fecha_i = Data's start date. DateTime object with year, month, day, hour and 10 minute interval (0, 10, 20, 30, 40, 50).
      • fecha_f = Data's end date. Same as fecha_i
      • reporte_produccion = True / False. Indicate if production report should be downloaded automatically
      • reporte_trackers = True / False. Indicate if trackers report should be downloaded automatically
      • reporte_mensual = True / False. If True, downloads both reports. False has no effect.
      • exportar = True / 'todos' / 'produccion / 'trackers'.
        • If True or 'todos' exports everything.
        • 'produccion' and 'trackers' export the respective report each.
    • Added obtener_señales(): Takes in a dataframe of Measurement Locations (Mlocs) and fetches all possible signals.
    • Added obtener_mediciones(): Takes a dataframe of signal lists and fetches data
    • Added listado_señales_trackers(): Just a preset, that shows which signals are used for the monthly production report
    • Added listado_señales_produccion(): Just a preset, that shows which signals are used for the monthly tracker report
    • Added mediciones_disponibles(): Initializing function that loads every available signal, from BLC's cloud
    • Added descargar_datos_produccion(): Downloads data from listado_señales_produccion() signals using DatosCdO's start and end date parameters
    • Added descargar_datos_trackers(): Downloads data from listado_señales_trackers() signals using DatosCdO's start and end date parameters
    • Added exportar(reportes = str): Exports loaded data from preset reports ['todos', 'produccion', 'trackers'].

Version 0.0.24

  • DatosCROM()
    • estimar_ENS() now subtracts actual generated power from estimated power loss
    • Fixed bug: estimar_ENS() wasn't checking datatypes properly

Version 0.0.23

  • PPO() and DTE()

    • Fixed bug: Setting "filtro" on initialization had no effect on running functions with default parameters.
  • cl_CarpetaServicios()

    • Added: blctools now finds "Servicios" folder, even when it's not explicitly written in the OS Path.
  • DatosCROM()

    • Added: estimar_ENS() takes a list of ids and estimates the ENS for each incident, based on actual production values.
    • Added: estimar_ENS_incidencias_abiertas() fills the ENS of the incidents that are still open
    • Added: estimar_ens_inc_abiertas = False initialization parameter
    • Added: incidencias_a_editar = None, takes a dictionary of dictionaries. The first dict has the IDs of the incidents that have to be edited as keys and their corresponding values are a second dictionary that holds the new parameters (and new values) . Example: {18088:{ENS=800,Owner='NewOwner'},18089:{Hours=8,Origin='INT'}}
    • Fixed bug: Plant Active Power and Energy was being calculated from WTGs / Circuits and it shouldn't. It has it's own values
    • Excludes incidents with Hours or ENS < 0 on .incidencias and .incidencias_redux attributes, but not in incidencias_todas
    • cargar_incidencias is now False as default.
    • explotar_incidencias is now False as default.
  • Fechas module

    • Fixed bug: hora_op, fecha_op, sumar_mes / restar_mes now have prevenir_futuro=False as default parameter and pass it to validar_fecha(s)
    • Fixed bug: obtener_periodo now has prevenir_futuro=True as default parameter and passes it to mes_periodo(s)
  • TablasVC()

    • Added .consultar_agrupamiento_de_un_equipo()
    • Added .modificar_incidencia() to edit a current incident
    • Fixed Bug: Query for incidencias was not returning open incidents

Version 0.0.22

  • DatosCROM()
    • Added: One can now initialize the "parques" parameter with a single string, to avoid using brackets when working with just one park.
    • Fixed bug: Eerror when no active incidents were found for a given parq/period and trying to .interpretar_incidencias_bajo_iec61400()
    • Fixed bug: Some functions where trying to call TablasVC().consultar_incidencias() which doesn't exist anymore. Now its .consultar(incidencias='offline')

Version 0.0.21

  • DatosCROM()

    • Added: .buscar_indisponibilidades(). Searches for periods of time which the WTGs met certain condition filters of out of service
    • Added: .buscar_limitaciones(). Searches for periods of time which the PLANT or WTGs had an SP_P > than the max.
    • Added: .buscar_incidencias() combines both previous functions in a single line.
    • Added: .incidencias_autodetectadas attribute, with export capabilities
    • Added: "Status" column to incidencias_redux
    • Added: "Count" and "Histogram" columns when calculating powercurves. _count "sheet" on export is now always there.
    • Added: "explotar_incidencias" initialization parámeter, which can take either 'iec61400' (default) or 'crudas'
    • Fixed bug: Missing Indices on datos_seg when trying to consolidate incidents and 10second data
    • _identificar_indisponibilidades() pgen and ppos parameters were added, to further improve filtering capacity
    • __procesar_d10s_dc() and cargar_segundales() now use DataFrame.reindex() to fill with blank rows where necessary.
    • elaborar_curvas_de_potencia() now sorts index clockwise instead of alphabetically
  • TablasVC()

    • Added .consultar_agrupamiento_de_un_equipo()

Version 0.0.20

  • DatosCROM()
    • interpretar_incidencias_bajo_iec61400() made more efficient, while keeping compatibility with pandas >= 1.5.0
    • _identificar_indisponibilidades() pgen and ppos parameters were added, to further improve filtering capacity
  • TablasVC()
    • Added "potencia=False" parameter to consultar_agrupamientos(), consultar_equipos_no_agrupamientos()

Version 0.0.19

  • DatosCROM()
    • Fixed bug: interpretar_incidencias_bajo_iec61400() was experiencing problems with pandas >= 1.5.0, and had a problem with the index selection statement at the beginning.
    • Added experimentally: _identificar_indisponibilidades(duracion=30)

Version 0.0.18

  • DatosCROM()
    • .exportar() now flattens MultiIndex columns, freezes panes and formats floats, for easier view on Excel.
    • Added "invalidar_datos_seg_congelados" initialization parameter (default = False)
    • Fixed bug: .exportar() throwing error when curvas_de_potencia or consolidado held more than 1 Dataframe
    • Fixed bug: .interpretar_incidencias_bajo_iec61400() now trims final result between fecha_i and fecha_f
    • Fixed bug: .elaborar_curvas_de_potencia() wasn't working properly with filtro_n >1

Version 0.0.17

  • fechas submodule
    • Added .sem_dia_1(date,offset=0) function. Returns first day of week of the given date + given offset in days (offset can be negative)
    • Added .sem_act_dia_1(offset=0) function. Returns first day of current week + given offset in days
    • Added .año_op(fecha_actual,fecha_cod) function. Returns the current contractual year based on the two dates (First year is 1, not 0)
  • DatosCROM()
    • adjusted how xlsx files processing time is calculated
    • adjusted how .pickle files are created/read. Compression was added through bz2
    • consolidado attribute is now called consolidado_redux, which is a subset of columns of consolidado
    • consolidado attribute now holds all the original data, but resampled to the users' input sample rate, excluding categorical variables
    • consultar_equipos_parque() and consultar_equipos_parque_no_agrupamientos() are now called consultar_equipos() and consultar_equipos_no_agrupamientos()
    • __iec61400_preparar_df_vacio_minutal() and it's aux methods are now more efficient
    • Added variables "Gen", "Con", "Pos" as boolean series for each equipment, into the datos_seg dataframe
    • Added columns "ENS_Lim","ENS_LimExt","ENS_LimInt","ENS_Ind","ENS_IndExt,"ENS_IndInt" to "consolidado" report
    • Added variable "Datos_%" which indicates the ammount of not null data per row, per element, into the datos_seg dataframe
    • Added variable "Registros" which indicates the ammout of rows (measured in time) on the excel file for that given element. Should alwasy equal 24
    • Fixed bug: .__procesar_d10s_5i() wasn't ensuring boolean dtypes for 'Gen','Con' and 'Pos', which impacted negatively on .elaborar_reporte_consolidado()
    • Fixed bug: .consolidar_todo() wasn't working with PEGARCIG
    • Fixed bug: .consolidar_todo() wasn't working adding up HOUR columns properly (the rest was fine)
    • Fixed bug: .consolidar_todo() wasn't finishing if there weren't any incidents for a given park on a given time window
    • Fixed bug: .explotar_incidencias() now works properly if there aren't any incidents on a given time window
    • Fixed bug: .exportar() was exporting empty dataframes, since they were not "None"
    • Fixed bug: Roll-up of availability parameters wasn't being done correctly. Now groupings are the mean or logic operator of their groupped elements.
    • Fixed bug: 10s pre-processing: Wind_dir_r was not being saved correctly for 'PLANT' element on self.datos_seg
    • Fixed bug: 10 second data is now being completed (in case of missing 10second records) with null values. This could have lead to serious problems when
    • Fixed bug: On many methods. From pandas >= 1.5.0 numpy series where linked and not copied when creating a new df. This created many bugs throughout the whole program.
    • unloading incidents to the 10 second data, since the main mechanism behind it is selection trhough .loc[t_stamp,:]
  • TablasVC()
    • Added attributes .habilitaciones and .tipohabilitaciones which are new tables of "datos básicos". They contain COD related information of each plant
    • Added .consultar_cod(nemo_parque='',uc='') function, to quickly find out about a plant's COD (Birthday) date (grabs from the table above)
    • Added .consultar_año_op(fecha_actual,feca_cod) function. Returns the contractual year (Contractual age) of a power plant
    • Added .__crear_dict_tipo_empresa(). Which fills in thre internal attributes: _empresas_bop, _empresas_gen, _empresas_grid
    • Fixed bug: .consultar() would fetchdatos_basicos from offline file even when 'online' parameter was set. This was due to:
      • a logic error of variable db_off inside .consultar()
      • the order in which instructions were executed
    • Fixed bug: __procesar_incidencias_it2() wasn't executing properly when cargar_datos_basicos = 'offline' was set. Solved by calling the new function .__crear_dict_tipo_empresa() before business mapping
    • Fixed bug: Desconecting twice from DB when fetching incidencias
    • Fixed bug: __combinar_incidencias_locales_y_online() wasn't working properly. Duplicate dropping should only be done by 'ID'
    • Refactored __asignar_datos() .method, to make it modular per table

Version 0.0.16

  • DatosCROM()
    • Added data invalidation when processing 10 second data. Now consecutive values of P, Q, Wind, Wind_dir and PPos != 0 and != max (for Ppos) are replaced with np.nan
    • Fixed bug when selecting no .parques ( [] ) and initializing a DatosCROM object
    • Fixed bug when truying to export specific reports through the generating functions (ie elaborar_curvas_de_potencia, interpretar_bajo_iec61400, etc.) and seeting the "exportar" parameter to True
    • Fixed bug. PI wasn't being correctly calculated. (* instead of / was being used)
    • Added "filtro_n" parameter to .elaborar_curvas_de_potencia(), to only show results with an n_count >= n per bin. Default 0 (deactivated)
    • Added feature. Ppos is being calculated if column doesn't exist, based on Curvas_de_potencia.xlsx on BLC's cloud under blc.get_dc_cfg() directory
    • "clientes" initializing parameter was removed (little use for it)
    • "solo_CROM" initializing parameter was removed (little use for it)
  • TablasVC()
    • Improved the processing of incidents, now "Origin" is "NA" and np.nan resistent. Default = "INT"
    • Fixed bug through which a filter for discarded incidents wasn't working.
    • Refactored processing of incidents, it's more readable now

Version 0.0.15

  • DatosCROM()
    • .exportar() was added. Helper function to export all loaded reports to xlsx format.
    • .explotar_incidencias() now takes in optional export parameters.
    • .incidencias_interpretar_bajo_iec61400() now takes in optional export parameters.
    • .incidencias_identificar_solapamientos() was added.
    • "curvas_de_potencia" parameter added while initializing, to force power curves to be computed automatically
    • .elaborar_curvas_de_potencia() is now more resistent to failures. Powercurves can be elaborated without having to process incidents before, although not recommended if user doesn't know what he is doing.
    • changed how __renombrar_lvl0() works, now it must be feed the equipment names.
  • TablasVC()
    • fixed a bug, where .consultar_equipos_parque_no_agrupamientos would return "PLANT" twice for GRIOEO
    • "cargar_incidencias" and "cargar_datos_basicos" parameters added while initializing, with possible values being [Flase, True, 'offline', 'online']
    • now queries per default active incidents from the 1st day of two months prior to today (if True or 'online' values where passed to "cargar_incidencias" parameter). Then concatenates obtained results with offline results (if there are any).

Version 0.0.14

  • TablasVC()
    • Fixed bug: Corrected functions that took equipments from blctools.TablasVC().conjuntogeneradores, now reading from .tipoequipo
    • Fixed bug: Now Parks without any grouping of it's generators can return the generators without grouping. Special Case: PEGARCIG
  • SQLConnector()
    • now decrypts login data from BLC's secure fileserver.
  • DatosCROM()
    • .consultar_equipos_parque() now retrieves the right elements if the plant doesn't havy any other grouping stages
    • .consultar_equipos_por_agrupamiento() now returns an empty list if the plant doesn't havy any other grouping stages
    • .rpt_consolidado(granularidad='1D') was added.
    • "forzar_reprocesamiento" parameter added while initializing, to force re-process 10 second data.
    • .rpt_curvas_de_potencia() was added
    • changed the behaviour of .fecha_i and .fecha_i setters. They now attempt to update "incidencias" and "archivos" depending on the values of fecha_i and fecha_f, but the setters dont try to order the dates automatically, which lead to an unwanted behaviour.
    • Changed completely how DatosCROM() now proceses raw data (10 seconds and Incidencias). It's more efficient, and the heavy lifting occurs while processing the 10-second data. Now index has 1 column (Time) and columns have a 3 level structure (p,e,v) = Park, Element, Variable

Version 0.0.13

  • Created SQLConnector class to migrate to SQLAlchemy
  • blctools.TablasVC now inherits from SQLConnector

Version 0.0.12

  • Function blctools.fechas.obtener_periodo() was added (moved from blctools.ReporteBase())
  • Added more parameter flexibility within all functions inside blctools.fechas.
  • Objects PPO(), DTE() and DatosCROM() now accept the "periodo" initialization parameter (overrides fecha_i and fecha_f).
  • bjects blctools.DatosCROM() and blctools.TablasVC() have now the "solo_CROM=False" initialization parameter.
  • function blctools.TablasVC.consultar_nemoCammesa() has now the "solo_CROM=False" argument

Version 0.0.11

  • Corrected blctools.PPO.periodo('mes_anterior')
  • Function ReporteBase.a_excel() accepts now the parameter "exportar_consulta=bool"
  • Objects PPO() and DTE() now accept the following initialization parameters
    • "filtro"
    • "periodo" (overrides fecha_i and fecha_f)
  • No more unnecessary warnings on changing the "filtro" parameter
  • Function blctools.fechas.mes_dia_1() and blctools.fechas.mes_ult_dia() now validate dates using blctools.fechas.validar_fechas()
  • Functions blctools.fechas.validar_fecha() and .validar_fechas() now have a parameter "prevenir_futuro=True" as default, to prevent future dates or not.
  • Fixed a bug, when changing "filtro" on functions of child classes of DTE() or PPO(), download and extraction directories wouldn't update properly.

Version 0.0.10

  • Attribute blctools.DatosCROM.dir_salida sets to which directory the reports go out to (didn't have much impact before)
  • Improved automatic Servicios directory search

Version 0.0.9

  • Removed dependencies list
  • Ability to download unfiltered PPOs/DTEs without specifying parks/plants list
  • Incidents are no longer loaded by default on blctools.DatosCrom() objects

Version 0.0.8

  • Corrected dependencies list

Version 0.0.6 ~ 0.0.7

  • Bug fixes regarding file management
  • Ability to customize filters when hitting CAMMESA's API
  • PBA calculation according to IEC61400 is still functioning incorrectly

Version 0.0.5

  • Most of the code is Object Oriented now.
  • CAMMESA's forecasts have been added.

Version 0.0.2 ~ 0.0.4

  • Fixed the install issues

Version 0.0.1

  • Basic functionality is up and running

TO DOs

  • Prevenir que se intenten procesar archivos excel 10 segundales que no tengan datos
  • Corroborar que la cantidad de grupos de columnas en los archivos 10 segundales, coincida con la cantidad de equipos del parque cuyo nombre de archivo enuncia.
  • Convertir DatosCROM().parques a "nemos" automáticamente.
  • Poder tomar mediciones SMEC de la BD del VC
  • Mejorar los mensajes de procesamiento nivel 0, 1 y 2 en todas las funciones
  • Fix Bug: Code could break by passing an '' element into parques initialization parameter

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blctools-0.0.25.tar.gz (78.3 kB view details)

Uploaded Source

Built Distribution

blctools-0.0.25-py3-none-any.whl (78.7 kB view details)

Uploaded Python 3

File details

Details for the file blctools-0.0.25.tar.gz.

File metadata

  • Download URL: blctools-0.0.25.tar.gz
  • Upload date:
  • Size: 78.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for blctools-0.0.25.tar.gz
Algorithm Hash digest
SHA256 481753c25dc0a2c593240abec295e7f7849a79f5c6684a8a8167792d95d434d9
MD5 ddaee080834f4a63f76ce773924394ca
BLAKE2b-256 9bfb63e9dde8d63b73cd2655c09d0b5790475c328e8f63099418b94819c03556

See more details on using hashes here.

File details

Details for the file blctools-0.0.25-py3-none-any.whl.

File metadata

  • Download URL: blctools-0.0.25-py3-none-any.whl
  • Upload date:
  • Size: 78.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for blctools-0.0.25-py3-none-any.whl
Algorithm Hash digest
SHA256 1543f3156d96239524fb9472fd609433cd9242f4ab86586157503fa1aa6641b2
MD5 e38d24e87846f2bd88b080d0e17288cf
BLAKE2b-256 dd62d723da3271c38e28f78a4952c35b045faf2954035374e99e4a0e46394591

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page