intermagnet_level0.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:pyrsss 作者: butala 项目源码 文件源码
def setup_netcdf_root(root,
                      header,
                      N):
    """
    Add variables, dimensions (all of size *N), and attributes from
    *config* to :class:`Dataset` *root* and return *root*.
    """
    # add global attributes
    root.source = header.Source_of_Data
    root.station = header.Station_Name
    root.code = header.IAGA_CODE
    root.latitude = header.Geodetic_Latitude
    root.longitude = header.Geodetic_Longitude
    root.elevation = header.Elevation
    root.reported = header.Reported
    root.sensor_orientation = header.Sensor_Orientation
    root.data_interval_type = header.Data_Interval_Type
    root.data_type = header.Data_Type
    root.creation_time_utc = str(datetime.utcnow())
    # add dimensions
    time_dim = root.createDimension('time', N)
    codes = ['X', 'Y', 'Z', 'F', 'H', 'D']
    for code in codes:
        dim = root.createDimension(code, N)
    # add variables
    time = root.createVariable('time', 'f8', ('time',))
    time.standard_name = 'time'
    time.units = 'seconds since 2000-01-01 12:00:00.0'
    time.calendar = 'gregorian'
    for code in codes:
        var = root.createVariable(code,
                                  'f8',
                                  (code,),
                                  zlib=True)
        var.standard_name = NAME_MAP[code]
        var.units = UNITS_MAP[code]
    return root
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号