Giter Site home page Giter Site logo

micaps_mdfs's Introduction

Micaps_MDFS

一个解码MICAPS4分布式数据环境中的数据文件(MDFS)的小程序,支持站点数据和网格数据的解码。

使用方法

站点数据:

from read_mdfs import MDFS_Station
import matplotlib.pyplot as plt
import matplotlib.colors as ccolor
import matplotlib.cm as cmx
import cartopy.crs as ccrs
import cartopy.feature as cfeature

x = MDFS_Station(r'D:\20181028160000.000')
lon = x.data['Lon'] # 经度
lat = x.data['Lat'] # 纬度
var = x.data[603] # 气象要素

cm = plt.get_cmap('jet')
cNorm = ccolor.Normalize(vmin=min(var), vmax=max(var))
scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=cm)
c = scalarMap.to_rgba(var)
ax = plt.axes(projection=ccrs.PlateCarree())
ax.scatter(lon, lat, s=5, c=c)
ax.coastlines(resolution='10m')
ax.add_feature(cfeature.BORDERS)
plt.show()

MDFS_Station类含有的属性: data_dsc:描述信息 level:数据层面 level_dsc:层面描述信息 utc_time:数据时间(世界时),为datetime.datetime类型 data:主体数据,为dict类型,含有的键值有ID(站号),Lon(经度),Lat(纬度)以及数据里对应的物理量数据的编号(见dtype_link.xml

网格数据:

from read_mdfs import MDFS_Grid
import numpy as np
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
import cartopy.feature as cfeature
import metpy.calc as mpcalc
from metpy.units import units
filepath = r'D:\18110408.000'
f = MDFS_Grid(filepath)
lon = f.data['Lon'] # 经度
lat = f.data['Lat'] # 纬度 PS:均为一维数组,使用前需np.meshgrid
norm = f.data['Norm'] # 向量数据中的模长
dir = f.data['Direction'] # 向量数据中的角度
u, v = mpcalc.wind_components(norm * units('m/s'), dir * units.degree)
ax = plt.axes(projection=ccrs.PlateCarree())
ax.streamplot(lon, lat, u, v, density=3)
ax.coastlines(resolution='10m')
ax.add_feature(cfeature.BORDERS)
plt.show()

MDFS_Grid类含有的属性: datatype:文件类别 model_name:模式名称 element:物理量名称 data_dsc:描述信息 level:数据层面 utc_time:数据时间(世界时),为datetime.datetime类型 data:主体数据,为dict类型,具体见例子中的注释

micaps_mdfs's People

Contributors

cyanidecn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.