我有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文件:
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非常陌生,所以如果有人能帮我的话,我很感激它。
发布于 2022-02-21 23:50:24
我首先通过提取我想要的变量来解决这个问题:
v1= nc1.variables['variable'][:]
v2= nc2.variables['variable'][:]
and ...由于v类型是"numpy.ma.core.MaskedArray",所以我通过以下方式将它们连接起来:
import numpy.ma as ma
v=ma.concatenate([v1,v2,...])https://stackoverflow.com/questions/71183569
复制相似问题