巴西水文气象是一个开放的时间序列。

hydrobr的Python项目详细描述


氢化橡胶DOIPythonVersion

HydroBr是一个与巴西水文气象时间序列一起工作的开源软件包。在

简介

HydroBr是一个开源软件包,用于在Python中处理巴西水文气象时间序列。这个包裹 提供与巴西国家水务局(Ag encia Nacional deÁguas-ANA)的联系 国家气象研究所(国家气象研究所-INMET)和国家电力系统 运营商(Operador Nacional do Sistema Elétrico-ONS)数据库,帮助用户选择、下载, 对水文气象资料进行预处理和绘图。在

安装

HydroBr的发布版本是0.1.1。在

要安装发布的版本,请使用pip install hydrobr。在

您可以通过克隆 GitHub存储库,并使用安装脚本:

git clone https://github.com/wallissoncarvalho/hydrobr.git
cd hydrobr
python setup.py install

模块-文档

目前,HydroBr包有四个模块:

  • get_data-提供与巴西国家水务局连接的功能 巴西国家气象研究所 (国家气象研究所-INMET)和国家电力系统运营商 (Operador Nacional do Sistema Elétrico-ONS)数据库。在

  • 绘图-您将有一些数据绘图选项,例如甘特图(临时数据可用性)图形、流持续时间 并绘制空间站可用性图。在

  • 预处理-提供一个函数,根据日期、数据年数和缺失百分比筛选数据。 此外,还有一个转换数据的函数。在

  • SaveAs-提供将数据保存到ASCII标准的“.txt”文件中的函数。在

将尽快用新功能/方法更新模块。欢迎投稿!在

进口液压br

^{pr2}$

来自ANA

help(hydrobr.get_data.ANA)
Help on class ANA in module hydrobr.get_data:

class ANA(builtins.object)
 |  It provides a connection with the Brazilian National Water Agency (Agência Nacional de Águas - ANA) database
 |  
 |  Static methods defined here:
 |  
 |  flow_data(list_station, only_consisted=False)
 |      Get the flow station data series from a list of stations code of the Brazilian National Water Agency
 |      (ANA) database.
 |      
 |      Parameters
 |      ----------
 |      list_station : list of strings
 |          A list of with the stations code as strings.
 |      only_consisted : boolean, default False
 |          If True, returns only the data classified as consistent by the provider.
 |      
 |      Returns
 |      -------
 |      data_stations : pandas DataFrame
 |          The data os each station as a column in a pandas DataFrame
 |  
 |  list_flow_stations(state='', city='', source='ANAF')
 |      Searches for flow/stage stations registered at the Brazilian National Agency of Water inventory.
 |      
 |      Parameters
 |      ----------
 |      state : string
 |          Brazilian state name where the stations are located (e.g., Rio de Janeiro)
 |      city : string
 |          Brazilian city name where the stations are located (e.g., Rio de Itaperuna)
 |      source: string, default 'ANAF'
 |          The source to look for the data. 'ANA' to get the list of stations from the Brazilian National Water
 |          Agency (ANA) database, or 'ANAF' to get the filtered list of stations that contain only the stations
 |          from ANA with registered data.
 |          More information about ANAF: https://doi.org/10.5281/zenodo.3755065
 |      
 |      Returns
 |      -------
 |      list_stations : pandas DataFrame
 |          The selected list of stations as a pandas DataFrame
 |  
 |  list_prec_stations(state='', city='', source='ANAF')
 |      Searches for precipitation stations registered at the Brazilian National Agency of Water (ANA)
 |      
 |      Parameters
 |      ----------
 |      state : string
 |          Brazilian state name where the stations are located (e.g., Rio de Janeiro)
 |      city : string
 |          Brazilian city name where the stations are located (e.g., Rio de Itaperuna)
 |      source: string, default 'ANA'
 |          The source to look for the data. 'ANA' to get the list of stations from the Brazilian National Water
 |          Agency (ANA) database, or 'ANAF' to get the filtered list of stations that contain only the stations
 |          from ANA with registered data.
 |          More information about ANAF: https://doi.org/10.5281/zenodo.3755065
 |      
 |      Returns
 |      -------
 |      list_stations : pandas DataFrame
 |          The selected list of stations as a pandas DataFrame
 |  
 |  prec_data(list_station, only_consisted=False)
 |      Get the precipitation station data series from a list of stations code.
 |      
 |      Parameters
 |      ----------
 |      list_station : list of strings
 |          A list of with the stations code as strings.
 |      only_consisted : boolean, default False
 |          If True, returns only the data classified as consistent by the provider.
 |      
 |      Returns
 |      -------
 |      data_stations : pandas DataFrame
 |          The data os each station as a column in a pandas DataFrame
 |  
 |  stage_data(list_station, only_consisted=False)
 |      Get the stage station data series from a list of stations code of the Brazilian National Water Agency
 |      (ANA) database.
 |      
 |      Parameters
 |      ----------
 |      list_station : list of strings
 |          A list of with the stations code as strings.
 |      only_consisted : boolean, default False
 |          If True, returns only the data classified as consistent by the provider.
 |      
 |      Returns
 |      -------
 |      data_stations : pandas DataFrame
 |          The data os each station as a column in a pandas DataFrame
 |  
 |  ----------------------------------------------------------------------    

来自INMET

help(hydrobr.get_data.INMET)
Help on class INMET in module hydrobr.get_data:

class INMET(builtins.object)
 |  It provides a connection with the  Brazilian National Institute of Meteorology (Instituto Nacional de
 |  Meteorologia - INMET) database.
 |  
 |  Static methods defined here:
 |  
 |  daily_data(station_code, filter=True)
 |      Searches for all the data of a station registered at the Brazilian National Institute of Meteorology
 |      (Instituto Nacional de Meteorologia - INMET) database.
 |      
 |      Returns a pandas daily DataFrame with six variables for each day:
 |          - Prec - Precipitation (mm)
 |          - Tmean - Daily mean Temperature (ºC)
 |          - Tmax - Maximum Temperature (ºC)
 |          - Tmin - Minimum Temperature (ºC)
 |          - RH - Relative Humidity (%)
 |          - SD - Sunshine Duration (hours)
 |      
 |      Parameters
 |      ----------
 |      station_code : string
 |          Code of the station as a string
 |      filter: boolean, default True
 |          There is stations with repeated registered data. If 'True' the function returns a panda DataFrame
 |          with the first occurrence of the date. If 'False' return a pandas DataFrame with, in some cases,
 |          repeated datetime index.
 |      
 |      Returns
 |      -------
 |      data : pandas DataFrame
 |          The data of the selected station as a pandas DataFrame
 |  
 |  hourly_data(station_code)
 |      Searches for all the data of a station registered at the Brazilian National Institute of Meteorology
 |      (Instituto Nacional de Meteorologia - INMET) database.
 |      
 |      Only works for Automatic Stations.
 |      
 |      Returns a pandas hourly DataFrame with 17 variables for each day:
 |          - Tins - Instant Temperature (ºC)
 |          - Tmax - Maximum Temperature (ºC)
 |          - Tmin - Minimum Temperature (ºC)
 |          - RHins - Instant Relative Humidity (%)
 |          - RHmax - Maximum Relative Humidity (%)
 |          - RHmin - Minimum Relative Humidity (%)
 |          - DPins - Instant Dew Point Temperature (ºC)
 |          - DPmax - Maximum Dew Point Temperature (ºC)
 |          - DPmin - Minimum Dew Point Temperature (ºC)
 |          - Pins - Instant Pressure (hPa)
 |          - Pmax - Maximum Pressure (hPa)
 |          - Pmin - Minimum Pressure (hPa)
 |          - Wspeed - Wind Speed (m/s)
 |          - Wdir - Wind direction (º)
 |          - Wgust - Wind gust (m/s)
 |          - Rad - Global Radiation (kJ/m²)
 |          - Prec - Precipitation (mm)
 |      
 |      Parameters
 |      ----------
 |      station_code : string
 |          Code of the station as a string.
 |      
 |      Returns
 |      -------
 |      data : pandas DataFrame
 |          The data of the selected station as a pandas DataFrame.
 |  
 |  list_stations(station_type='both')
 |      Searches for precipitation stations registered at the Brazilian National Agency of Water (ANA) or the INMET
 |      inventory.
 |      
 |      Parameters
 |      ----------
 |      station_type : string, default 'both'
 |          The type of station. 'both' to get the list of automatic and manual gauge stations, 'automatic' to get only
 |          the automatic gauge stations, and 'conventional' to get only the conventional gauge stations.
 |      Returns
 |      -------
 |      list_stations : pandas DataFrame
 |          The selected list of stations as a pandas DataFrame
 |  
 |  ----------------------------------------------------------------------    

来自国家统计局的数据

help(hydrobr.get_data.ONS)
Help on class ONS in module hydrobr.get_data:

class ONS(builtins.object)
 |  Provide data from the National Electric System Operator (Operador Nacional do Sistema Elétrico - ONS) database.
 |  
 |  Static methods defined here:
 |  
 |  daily_data()
 |       Returns all the naturalized daily flow data of different reservoirs from the National Electric System
 |       Operator (Operador Nacional do Sistema Elétrico - ONS) database.
 |      
 |      Parameters
 |      ----------
 |      
 |      Returns
 |      -------
 |      data : pandas DataFrame
 |          All the naturalized daily flow data as a pandas DataFrame, where each column refers to a specific
 |          reservoir.  
 |  ----------------------------------------------------------------------    

预处理方法

help(hydrobr.PreProcessing)
Help on class PreProcessing in module hydrobr.preprocessing:

class PreProcessing(builtins.object)
 |  Static methods defined here:
 |  
 |  daily_to_monthly(data, method='sum')
 |      Transform a time series of daily data into a time series monthly data.
 |      
 |      In the conversion process a month with a day missing data is considered as a missing month.
 |      
 |      Parameters
 |      ----------
 |      data : pandas DataFrame
 |          A Pandas daily DataFrame with DatetimeIndex where each column corresponds to a station.
 |      method: str, default sum
 |          The method used to convert. If 'sum', the monthly data will be the sum of the daily data. If 'mean', the
 |          monthly data will be the mean of the daily data.
 |      
 |      Returns
 |      -------
 |      monthly_data : pandas DataFrame
 |          The  monthly pandas DataFrame
 |  
 |  stations_filter(data, n_years=10, missing_percentage=5, start_date=False, end_date=False)
 |      A composed method to filter stations. 
 |      
 |      First, the method filters the stations data by the Start Date and the End Date, it its passed. After that,
 |      the is selected only the stations with at least a defined number of years between the first date and the
 |      last date of the station. At the end is selected the stations that contains at least one window of data with
 |      the number of years and a maximum missing data percentage. 
 |      
 |      Parameters
 |      ----------
 |      data : pandas DataFrame
 |          A Pandas daily DataFrame with DatetimeIndex where each column corresponds to a station.
 |      n_years: int, default 10
 |          The minimum number of years of registered data for the station between the first date and the end date.
 |      missing_percentage: int, default 5
 |           The maximum missing data percentage in a window with n_years.
 |           A number between 0 and 100
 |      start_date : int, float, str, default False
 |          The desired start date for the output DataFrame.
 |          See: pandas.to_datetime documentation if have doubts about the date format
 |      end_date: int, float, str, default False
 |          The desired end date for the output DataFrame.
 |          See: pandas.to_datetime documentation if have doubts about the date format
 |      
 |      Returns
 |      -------
 |      data : pandas DataFrame
 |          A pandas DataFrame with only the filtered stations
 |  
 |  ---------------------------------------------------------------------- 

绘图方法

help(hydrobr.Plot)
Help on class Plot in module hydrobr.graphics:

class Plot(builtins.object)
 |  Static methods defined here:
 |  
 |  fdc(data, y_log_scale=True)
 |      Make a flow duration curve plot.
 |      
 |      Parameters
 |      ----------
 |      data : pandas DataFrame
 |          A Pandas daily DataFrame with DatetimeIndex where each column corresponds to a station..
 |      y_log_scale : boolean, default True
 |          Defines if the the plotting y-axis will be in the logarithmic scale.
 |      
 |      Returns
 |      -------
 |      fig : plotly Figure
 |  
 |  gantt(data, monthly=True)
 |      Make a Gantt plot, which shows the temporal data availability for each station.
 |      
 |      Parameters
 |      ----------
 |      data : pandas DataFrame
 |          A Pandas daily DataFrame with DatetimeIndex where each column corresponds to a station..
 |      monthly : boolean, default True
 |          Defines if the availability count of the data will be monthly to obtain a more fluid graph.
 |      
 |      Returns
 |      -------
 |      fig : plotly Figure
 |  
 |  spatial_stations(list_stations, mapbox_access_token)
 |      Make a spatial plot of the stations.
 |      
 |      Parameters
 |      ----------
 |      list_stations : pandas DataFrame
 |          A Pandas DataFrame that must contain Latitude, Longitude, Name, and Code columns.
 |      mapbox_access_token : str
 |          Mapbox access toke, which can be obtained at https://account.mapbox.com/access-tokens/
 |      
 |      Returns
 |      -------
 |      fig : plotly Figure
 |  
 |  ----------------------------------------------------------------------

SaveAs方法

help(hydrobr.SaveAs)
Help on class SaveAs in module hydrobr.save:

class SaveAs(builtins.object)
 |  Static methods defined here:
 |  
 |  asc_daily_flow(data, path_save)
 |      Save each column of the flow stations DataFrame into a ".txt" file in the ASCII standard.
 |      
 |      Parameters
 |      ----------
 |      data : pandas DataFrame
 |          A Pandas daily DataFrame with DatetimeIndex where each column corresponds to a station.
 |      path_save: string
 |          The computer location where the ".txt" files will be saved.
 |      
 |      Returns
 |      -------
 |      Saved data in the path_save
 |
 |  asc_daily_prec(data, path_save)
 |      Save each column of the precipitation stations DataFrame into a ".txt" file in the ASCII standard.
 |      
 |      Parameters
 |      ----------
 |      data : pandas DataFrame
 |          A Pandas daily DataFrame with DatetimeIndex where each column corresponds to a station.
 |      path_save: string
 |          The computer location where the ".txt" files will be saved.
 |      
 |      Returns
 |      -------
 |      Saved data in the path_save
 |  ----------------------------------------------------------------------

模块

我的博客上的HydroBr页面上提供了使用示例。在

依赖关系

许可证

BSD 3-Clause License

如何引证

瓦利森·莫雷拉·德卡瓦略。(2020年7月5日)。HydroBr:一个Python包,用于巴西水文气象时间 系列。(版本0.1.1)。泽诺多。http://doi.org/10.5281/zenodo.3931027

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Spring MVC 4.0 RequestMapping无值,基于methodname   java Samsung 10 plus不允许wifi p2p发现   春爪哇。伊奥。IOException:找不到文件   java JasperReport饼图示例   java我试图使用mockito注释来测试我的代码,但无法解决mockito异常   命令行界面Java:制作简单的交互式cli应用程序   java jdk1之间的区别是什么。7_9 9和jdk1。7_271   java重载一个被重写的、继承的方法   java LazyInitializationException春季启动   java Play Framework 2.2.1 3个表之间存在大量关系