axiom数据科学开发和使用的海洋数据工具包

pyaxiom的Python项目详细描述


#Pyaxiom[![构建状态](https://travis ci.org/axiom data science/pyaxiom.svg)(https://travis ci.org/axiom data science/pyaxiom)

pyaxiom






pip install git+https://github.com/axiom data science/pyaxiom.git






<
<
<<
<<<
<






<

<安全的关闭
vanilla`netcdf4.dataset`对象会在试图关闭已关闭的文件时引发运行时错误。这不会提高。



``来自netcdf4导入数据集的python

nc=数据集('http://thredds45.pvd.axiomasalaska.com/thredds/dodsc/grabbag/usgs_cmg_wh_obs/wfal/9001rcm-a.nc')
nc.close()
nc.close()
最后)
<;ipython-input-18-db44c06d8538>;在<;模块>;(
--->;1 nc.close()
/home/kwilcox/.virtualenvs/霸王/lib/python2.7/site-packages/netcdf4.so在netcdf4.dataset.close(netcdf4.c:23432)中()
运行时错误:netcdf:不是来自pyaxiom.netcdf的有效ID

=数据集('http://thredds45.pvd.axiomsalaska.com/thredds/dodsc/grabbag/usgs/usgs/usgs/usg/usg/usg/usg/usg/usg/wfal/9001rccm-a.nc')
nc.close()
nc.close()
``` ` `

<
作为dataset
nc=dataset('http://thredds45.pvd.axiomaslaska.com/thredds/dodsc/grabbag/usgs_cmg_wh_obs/wfal/9001rcm-a.nc')


键入"netcdf4.variable">;
float64 latitude()
单位:北纬度
标准名称:纬度
长名称:传感器纬度
无限尺寸:
当前形状=(
填充
]

=nc.get_variables_by_attributes(Standard_name=lambda v:v不是none)
打印[变量中s的s.name]
[u'纬度',u'经度',u'深度',u't_28',u'cs_300',u'cd_310',u'u_1205',u'v_1206',u'o_60',u'do',u'时间]

返回属性单位等于m/s且具有网格映射属性的所有变量
variables=nc.get_variables_by_attributes(网格映射=lambda v:v不是none,units='m/s')
打印[变量中s的s.name]
[u'cs_300',u'u_',u'v_']
````








\ioos urns
[更多信息](https://geo-ide.noaa.gov/wiki/index.php?观察资产(资产)标识符的IOOS公约



>"权威":"公理",
"组件":无,
"标签":"站点1",
‘版本’:无}
打印u.urn
‘urn:ioos:station:axiom:station1’
````
`` python
``从pyaxiom.urn导入ioosurn
u=ioosurn.from ``字符串('urn:ioos:station:axiom:station1:axiom:station1’)
打印u.dict ` ` ` ` ` ` ` ` ` ` ` ` `(urn:ioos:station:station:station1:station1 ` ` ` ` ` ` ` `组件':无,
"label":"station1",
"version":无}
打印u.urn
"urn:ioos:station:axiom:station1"
`````

``pythom
``utils import urnify,dictify urn

"sensor"urn的netcdf变量属性
print dictify urn('urn:ioos:sensor:axiom:station1')
{标准名称:'wind\u speed'}

print dictify urn('urn:ioos:sensor:axiom:foo:lwe嫒u降水量的厚度嫒cell嫒u methods=时间:平均值,时间:方差;间隔=pt1h')
{标准名称':'lwe嫒u降水量的厚度',
"单元方法":"时间:平均时间:方差(间隔:pt1h)}

"从变量属性的‘dict’返回"
"属性={"标准名称":"风速"
"单元方法":"时间:平均(间隔:pt24h)}
"打印urnify('authority','label',属性)
'urn:ioos:sensor:authority:label:wind撸speed撸cell撸methods=time:mean;interval=pt24h'


'label',nc.variables['t_u 28'])
'urn:ioos:sensor:authority:label:sea_water_u temperature'
```



对于清理和优化非常有用。

这不会处理在时间上重叠的文件或在bin边界两边都有数据的文件。

````
用法:binner[-h]-o output-d{day,month,week,年份}[-f[factor]]
[-n[ncml_file][-g[glob_string][-a[-s hard_start]
[-e hard_end]


--output output
将二进制文件输出到
-d{day,month,week,year},--delta{day,month,week,year}
timedelta to bin by
-f[factor],--factor[factor]
要应用于delta的因子。通过"2"将是
(2)天或(2)个月。损坏为1。
-n[ncml_file],--ncml_file[ncml_file]
ncml包含用于
单个文件的聚合扫描。需要"ncml_file"或"glob_string"
。如果两者都传入,则使用"glob_string"
标识集合的文件,并对每个成员应用
"ncml_file"。
-g[glob_string],--glob_string[glob_string]
python glob.glob string用于文件
标识。需要"ncml_file"或"glob_string"之一。如果两者都传入,则"glob_string"用于标识集合的文件,并对每个成员应用"ncml_file"。
-a,--apply_to_members
标记在提取元数据之前将ncml应用于
聚合的每个成员。如果
使用"glob_string",则忽略此项。默认为False。
-s hard_start,--hard_start hard_start
开始聚合的日期时间字符串。只有在此日期时间或之后开始的
成员将被
处理。
-e hard懔end,--hard懔end hard懔end
结束聚合的日期时间字符串。只处理在此日期时间之前结束的
成员。
```


"PyAXIOM/tests/resources/coamps/coamps/cencoos-4km/wnd-tru/10m/*.nc"\
-d月1日
-f 1
````



`````````bash
```bash
binner\
--输出/output/monthly-bins\
--glob-globu-string"PyAXIOM/pyAXIOM-d月1
`````````````
>>``````````/测试/资源/coamps/cencos_4km/wnd_tru/10m/*.nc"\
-n pyaxiom/tests/resources/coamps_10km_wind.ncml\
-d month\
-f 1
````

`
`` bash
binner\
--输出/输出/月库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库库timeseries
`` python
来自pyaxiom.netcdf.sensors importtimeseries
filename='测试timeseries.nc'
times=[0,1000,2000,3000,4000,5000]
垂直=无
ts=timeseries(输出目录='./output',
纬度=32,wgs84
经度=-74,#wgs84
站点名='timeseries\u station',
全局属性=dict(id='myid'),
输出文件名='timeseries.nc',
时间=时间,
垂直=垂直)
值=[20,21,22,23,24,25]
attrs=dict(标准海水温度)
ts.add_variable('temperature,value=values,attattributes=attrs)
ts.close()
````





```pyaxiom.netcdf.sensors从pyaxiom.netcdf.netcdf.sensors导入timeseries



times=[0,1000,2000,3000,4000,4000,2000,4000,4000,4000,attrs=


times=[0,1000,2000,2000,2000,2000,2000,3000,3000,4000,4000,4000,4000,4000 5000年]#从epoch开始的秒数
垂直=[0,1,2]米向下
ts=时间序列(输出目录='./output',
纬度=32,wgs84
经度=-74,wgs84
站名='timeseriesprofile豸站',
全局属性=dict(id='myid'),
输出文件名='timeseriesprofile.nc',
时间=时间,
垂直=垂直)
值=np.重复([20,21,22,23,24,25],len(垂直的))
attrs=dict(标准的"海水温度")
ts.add_variable("温度",值=值,attributes=attrs)
ts.close()
```


pandas integration假设数据帧中存在一个序列列"time"和一个序列列"depth"。数据值从名为
"value"的列中提取,但也可以传入"data_column"属性以获得更多控制。

``python
from pyaxio.netcdf.sensors import timeseries
df=pd.dataframe({"time":[0,1,2,3,4,5,6],
"value":[10,20,30,40,50,60],
"深度":[0,0,0,0,0,0,0]})
timeseries.from_dataframe(df,
output_directory='./output',
纬度=30,经度=-74,station_name='dataframe_station',
全局_attributes=dict(id='myid'),
变量_name='values',
变量_attributes=dict(),
输出文件名='from_dataframe.nc')
```
``python
``df=pd.dataframe({'time':[0,1,2,3,4,5,6],
'temperature':[10,20,30,40,50,60],
'depth':[0,0,0,0,0]})
timeseries.from_dataframe(df,
output_directory='./output',
纬度=30,35; wgs84
经度=-74,wgs84
站名='dataframe_station',
全局属性=dict(id='myid'),
输出文件名='from_dataframe.nc',
变量名称='temperature',
变量属性=dict(标准名称='air_temperature'),
数据列'temperature')
```

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

推荐PyPI第三方库


热门话题
如何使用运行时从JAVA运行openssl命令?   不使用线程安全类(如AtomicInteger和SynchronizedList)的java ProducerConsumer问题   匹配字符串的java模式   在java中使用泛型接口作为返回类型   java将可能具有序列化JSON值的hashmap作为节点添加到JSON字符串中   Eclipse无法从Java8流推断正确的类型   java无法了解标准JButton的大小   java我能用一个循环优化这个函数吗(在第一种方法中)?   Apache CXF中基于WebSocket的java SOAP?   java想要运行奇偶和求和三步   矩阵上随机元素的java集值   java布尔相等:0==a,操作数顺序重要吗?   java Eclipse不会退出我的插件   java如何在spring的SOAP拦截器中获取HttpServletRequest和HttpServletResponse