当前位置: 首页>>代码示例>>Python>>正文


Python Timeseries.read_meta方法代码示例

本文整理汇总了Python中pthelma.timeseries.Timeseries.read_meta方法的典型用法代码示例。如果您正苦于以下问题:Python Timeseries.read_meta方法的具体用法?Python Timeseries.read_meta怎么用?Python Timeseries.read_meta使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pthelma.timeseries.Timeseries的用法示例。


在下文中一共展示了Timeseries.read_meta方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: time_step

# 需要导入模块: from pthelma.timeseries import Timeseries [as 别名]
# 或者: from pthelma.timeseries.Timeseries import read_meta [as 别名]
 def time_step(self):
     """
     Return time step of all time series. If time step is not the same
     for all time series, raises exception.
     """
     time_step = None
     for filename in self.files:
         with open(filename) as f:
             t = Timeseries()
             t.read_meta(f)
         item_time_step = (t.time_step.length_minutes,
                           t.time_step.length_months)
         if time_step and (item_time_step != time_step):
             raise WrongValueError(
                 'Not all time series have the same step')
         time_step = item_time_step
     return time_step
开发者ID:aptiko,项目名称:pthelma,代码行数:19,代码来源:spatial.py

示例2: create_ogr_layer_from_timeseries

# 需要导入模块: from pthelma.timeseries import Timeseries [as 别名]
# 或者: from pthelma.timeseries.Timeseries import read_meta [as 别名]
def create_ogr_layer_from_timeseries(filenames, epsg, data_source):
    # Prepare the co-ordinate transformation from WGS84 to epsg
    source_sr = osr.SpatialReference()
    source_sr.ImportFromEPSG(4326)
    target_sr = osr.SpatialReference()
    target_sr.ImportFromEPSG(epsg)
    transform = osr.CoordinateTransformation(source_sr, target_sr)

    layer = data_source.CreateLayer('stations', target_sr)
    layer.CreateField(ogr.FieldDefn('filename', ogr.OFTString))
    for filename in filenames:
        with open(filename) as f:
            ts = Timeseries()
            ts.read_meta(f)
        point = ogr.Geometry(ogr.wkbPoint)
        point.AddPoint(ts.location['abscissa'], ts.location['ordinate'])
        point.Transform(transform)
        f = ogr.Feature(layer.GetLayerDefn())
        f.SetGeometry(point)
        f.SetField('filename', filename)
        layer.CreateFeature(f)
    return layer
开发者ID:aptiko,项目名称:pthelma,代码行数:24,代码来源:spatial.py


注:本文中的pthelma.timeseries.Timeseries.read_meta方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。