首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >组合“for -循环”的多个nc文件和事件。

组合“for -循环”的多个nc文件和事件。
EN

Stack Overflow用户
提问于 2022-02-19 09:09:43
回答 1查看 65关注 0票数 0

我有5个nc文件,所有这些文件都包括维度和变量,如:

nc1:尺寸(尺寸):高度(801),频率(2),n_event(421)

nc2:尺寸(尺寸):高度(801),频率(2),n_event(306个)

nc3:尺寸(尺寸):高度(801),频率(2),n_event(527)

nc4:尺寸(尺寸):高度(801),频率(2),n_event(424)

nc5:尺寸(尺寸):高度(801),频率(2),n_event(487)

并查看nc文件:

代码语言:javascript
复制
variables(dimensions): float64 altitude(altitude), float64 frequency(frequency), float64 azimuth_of_occultation_plane(n_event), float64 bending_angle(n_event, altitude), float64 density(n_event, altitude), float64 dry_density(n_event, altitude), float64 dry_pressure(n_event, altitude), float32 dry_temperature(n_event, altitude), int64 event_id(n_event), float64 geoid_undulation(n_event), float64 geopotential_height(n_event, altitude), float64 impact_altitude(n_event, altitude), float64 incidence_angle_of_occultation_plane(n_event), float64 latitude(n_event), float32 latitude_trajectory(n_event, altitude), float64 longitude(n_event), float32 longitude_trajectory(n_event, altitude), float64 optimized_bending_angle(n_event, altitude), float64 pressure(n_event, altitude), int32 qc_bending_angle(n_event), int32 qc_dry_retrieval(n_event), int32 qc_physical_retrieval(n_event), int32 qc_refractivity(n_event), int32 qc_total(n_event), float64 radius_of_curvature(n_event), float64 raw_bending_angle(n_event, frequency, altitude), float64 refractivity(n_event, altitude), int32 set_rise_flag(n_event), float32 specific_humidity(n_event, altitude), float32 specific_humidity_raer(n_event, altitude), float32 specific_humidity_sigma(n_event, altitude), float64 surface_altitude(n_event), float32 temperature(n_event, altitude), float32 temperature_raer(n_event, altitude), float32 temperature_sigma(n_event, altitude), float64 time(n_event), int32 transmitter_id(n_event)
groups: 

我不知道如何将所有这5个NC文件组合在一起,因为我正在尝试对所有421+306+527+424+487事件进行for循环。

我对python非常陌生,所以如果有人能帮我的话,我很感激它。

EN

回答 1

Stack Overflow用户

发布于 2022-02-21 23:50:24

我首先通过提取我想要的变量来解决这个问题:

代码语言:javascript
复制
v1= nc1.variables['variable'][:]
v2= nc2.variables['variable'][:]
and ...

由于v类型是"numpy.ma.core.MaskedArray",所以我通过以下方式将它们连接起来:

代码语言:javascript
复制
import numpy.ma as ma
v=ma.concatenate([v1,v2,...])
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71183569

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档