Caiso
==========================

.. py:module:: gridstatus.caiso


Module Contents
---------------

Classes Summary
~~~~~~~~~~~~~~~

.. autoapisummary::

   gridstatus.caiso.CAISO




Functions
~~~~~~~~~

.. autoapisummary::
   :nosignatures:

   gridstatus.caiso.determine_lmp_frequency
   gridstatus.caiso.determine_oasis_frequency



Attributes Summary
~~~~~~~~~~~~~~~~~~~

.. autoapisummary::

   gridstatus.caiso.DAY_AHEAD_MARKET_MARKET_RUN_ID
   gridstatus.caiso.oasis_dataset_config
   gridstatus.caiso.REAL_TIME_DISPATCH_MARKET_RUN_ID


Contents
~~~~~~~~~~~~~~~~~~~
.. py:class:: CAISO

   Bases: :py:obj:`gridstatus.base.ISOBase`

   California Independent System Operator (CAISO)


   **Attributes**

   .. list-table::
      :widths: 15 85
      :header-rows: 0

      * - **default_timezone**
        - US/Pacific
      * - **interconnection_homepage**
        - https://rimspub.caiso.com/rimsui/logon.do
      * - **iso_id**
        - caiso
      * - **markets**
        - None
      * - **name**
        - California ISO
      * - **status_homepage**
        - https://www.caiso.com/TodaysOutlook/Pages/default.aspx
      * - **trading_hub_locations**
        - ['TH_NP15_GEN-APND', 'TH_SP15_GEN-APND', 'TH_ZP26_GEN-APND']


   **Methods**

   .. autoapisummary::
      :nosignatures:

      gridstatus.caiso.CAISO.get_as_prices
      gridstatus.caiso.CAISO.get_as_procurement
      gridstatus.caiso.CAISO.get_curtailed_non_operational_generator_report
      gridstatus.caiso.CAISO.get_curtailment
      gridstatus.caiso.CAISO.get_fuel_mix
      gridstatus.caiso.CAISO.get_fuel_regions
      gridstatus.caiso.CAISO.get_gas_prices
      gridstatus.caiso.CAISO.get_ghg_allowance
      gridstatus.caiso.CAISO.get_interconnection_queue
      gridstatus.caiso.CAISO.get_lmp
      gridstatus.caiso.CAISO.get_load
      gridstatus.caiso.CAISO.get_load_forecast
      gridstatus.caiso.CAISO.get_oasis_dataset
      gridstatus.caiso.CAISO.get_pnodes
      gridstatus.caiso.CAISO.get_raw_interconnection_queue
      gridstatus.caiso.CAISO.get_solar_and_wind_forecast_dam
      gridstatus.caiso.CAISO.get_stats
      gridstatus.caiso.CAISO.get_status
      gridstatus.caiso.CAISO.get_storage
      gridstatus.caiso.CAISO.get_tie_flows_real_time
      gridstatus.caiso.CAISO.list_oasis_datasets

   .. py:method:: get_as_prices(date, end=None, market='DAM', sleep=4, verbose=False)

      Return AS prices for a given date for each region

      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
                  If None, returns only date. Defaults to None.
      :type end: datetime.date, str
      :param market: DAM or HASP. Defaults to DAM.
      :type market: str
      :param verbose: print out url being fetched. Defaults to False.
      :type verbose: bool, optional

      :returns: A DataFrame of AS prices
      :rtype: pandas.DataFrame


   .. py:method:: get_as_procurement(date, end=None, market='DAM', sleep=4, verbose=False)

      Get ancillary services procurement data from CAISO.

      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
                  If None, returns only date. Defaults to None.
      :type end: datetime.date, str
      :param market: DAM or RTM. Defaults to DAM.

      :returns: A DataFrame of ancillary services data
      :rtype: pandas.DataFrame


   .. py:method:: get_curtailed_non_operational_generator_report(date, end=None, verbose=False)

      Return curtailed non-operational generator report for a given date.
          Earliest available date is June 17, 2021.


      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
                  If None, returns only date. Defaults to None.
      :type end: datetime.date, str
      :param verbose: print out url being fetched. Defaults to False.
      :type verbose: bool, optional

      :returns: A DataFrame of curtailed non-operational generator report

                column glossary:
                http://www.caiso.com/market/Pages/OutageManagement/Curtailed
                -OperationalGeneratorReportGlossary.aspx

                if requesting multiple days, may want to run
                following to remove outages that get reported across multiple days:
                ```df.drop_duplicates(
                    subset=["OUTAGE MRID", "CURTAILMENT START DATE TIME"], keep="last")```
      :rtype: pandas.DataFrame


   .. py:method:: get_curtailment(date, verbose=False)

      Return curtailment data for a given date

      .. rubric:: Notes

      * requires java to be installed in order to run
      * Data available from June 30, 2016 to present

      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
                  If None, returns only date. Defaults to None.
      :type end: datetime.date, str
      :param verbose: print out url being fetched. Defaults to False.

      :returns: A DataFrame of curtailment data
      :rtype: pandas.DataFrame


   .. py:method:: get_fuel_mix(date, start=None, end=None, verbose=False)

      Get fuel mix in 5 minute intervals for a provided day

      :param date: "latest", "today", or an object
                   that can be parsed as a datetime for the day to return data.
      :type date: datetime.date, str
      :param start: start of date range to return.
                    alias for `date` parameter.
                    Only specify one of `date` or `start`.
      :type start: datetime.date, str
      :param end: "today" or an object that can be parsed
                  as a datetime for the day to return data.
                  Only used if requesting a range of dates.
      :type end: datetime.date, str
      :param verbose: print verbose output. Defaults to False.
      :type verbose: bool, optional

      :returns: A DataFrame with columns - 'Time' and columns                 for each fuel type.
      :rtype: pandas.DataFrame


   .. py:method:: get_fuel_regions(verbose=False)

      Retrieves the (mostly static) list of fuel regions with associated data.
      This file can be joined to the gas prices on Fuel Region Id


   .. py:method:: get_gas_prices(date, end=None, fuel_region_id='ALL', sleep=4, verbose=False)

      Return gas prices at a previous date

      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
                  If None, returns only date. Defaults to None.
      :type end: datetime.date, str
      :param fuel_region_id: single fuel region id or list of fuel
                             region ids to return data for. Defaults to ALL, which returns
                             all fuel regions.
      :type fuel_region_id: str, or list

      :returns: A DataFrame of gas prices
      :rtype: pandas.DataFrame


   .. py:method:: get_ghg_allowance(date, end=None, sleep=4, verbose=False)

      Return ghg allowance at a previous date

      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
                  If None, returns only date. Defaults to None.
      :type end: datetime.date, str


   .. py:method:: get_interconnection_queue(verbose=False)


   .. py:method:: get_lmp(date, market: str, locations: list = None, sleep: int = 5, end=None, verbose=False)

      Get LMP pricing starting at supplied date for a list of locations.

      :param date: date to return data
      :type date: datetime.date, str
      :param market: market to return from. supports:
      :param locations: list of locations to get data from.
                        If no locations are provided, defaults to NP15,
                        SP15, and ZP26, which are the trading hub locations.
                        USE "ALL_AP_NODES" for all Aggregate Pricing Node.
                        Use "ALL" to get all nodes. For a list of locations,
                        call ``CAISO.get_pnodes()``
      :type locations: list
      :param sleep: number of seconds to sleep before returning to
                    avoid hitting rate limit in regular usage. Defaults to 5 seconds.
      :type sleep: int

      :returns: A DataFrame of pricing data
      :rtype: pandas.DataFrame


   .. py:method:: get_load(date, end=None, verbose=False)

      Return load at a previous date in 5 minute intervals


   .. py:method:: get_load_forecast(date, end=None, sleep=4, verbose=False)

      Returns load forecast for a previous date in 1 hour intervals

      :param date: day to return.
                   If string, format should be YYYYMMDD e.g 20200623
      :type date: datetime.date, pd.Timestamp, str
      :param sleep: number of seconds to sleep before returning to avoid
                    hitting rate limit in regular usage. Defaults to 5 seconds.
      :type sleep: int


   .. py:method:: get_oasis_dataset(dataset, date, end=None, params=None, raw_data=True, sleep=5, verbose=False)

      Return data from OASIS for a given dataset

      :param dataset: dataset to return data for. See CAISO.list_oasis_datasets
                      for supported datasets
      :type dataset: str
      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
                  If None, returns only date. Defaults to None.
      :type end: datetime.date, str
      :param params: dictionary of parameters to pass to dataset.
                     See CAISO.list_oasis_datasets for supported parameters
      :type params: dict
      :param raw_data: return raw data from OASIS. Defaults to True.
      :type raw_data: bool, optional
      :param sleep: number of seconds to sleep between
                    requests. Defaults to 5.
      :type sleep: int, optional
      :param verbose: print out url being fetched. Defaults to False.
      :type verbose: bool, optional

      :returns: A DataFrame of OASIS data
      :rtype: pandas.DataFrame


   .. py:method:: get_pnodes(verbose=False)


   .. py:method:: get_raw_interconnection_queue(verbose)


   .. py:method:: get_solar_and_wind_forecast_dam(date, end=None, verbose=False)

      Return wind and solar forecast in hourly intervals

      Data at: http://oasis.caiso.com/mrioasis/logon.do  at System Demand >
      Wind and Solar Forecast


   .. py:method:: get_stats(verbose=False)


   .. py:method:: get_status(date='latest', verbose=False) -> str

      Get Current Status of the Grid. Only date="latest" is supported

      Known possible values: Normal, Restricted Maintenance Operations, Flex Alert


   .. py:method:: get_storage(date, verbose=False)

      Return storage charging or discharging for today in 5 minute intervals

      Negative means charging, positive means discharging

      :param date: date to return data
      :type date: datetime.date, str


   .. py:method:: get_tie_flows_real_time(date, end=None, verbose=False)

      Return real time tie flow data.

      From OASIS: Energy > Energy Imbalance Market > EIM Transfer by Tie

      :param date: date to return data
      :type date: datetime.date, str
      :param end: last date of range to return data.
      :type end: datetime.date, str

      :returns: pandas.DataFrame


   .. py:method:: list_oasis_datasets(dataset=None)



.. py:data:: DAY_AHEAD_MARKET_MARKET_RUN_ID
   :value: 'DAM'

   

.. py:function:: determine_lmp_frequency(args)

   if querying all must use 1d frequency


.. py:function:: determine_oasis_frequency(args)


.. py:data:: oasis_dataset_config

   

.. py:data:: REAL_TIME_DISPATCH_MARKET_RUN_ID
   :value: 'RTD'

   

