使用Python提取NetCDF4中变量的数值

时间:2019-07-10 09:30:43

标签: python-3.x netcdf4

我需要理解如何在NetCDF4中获取一个通道IR_108(变量)的数值以及其他一些数据:

import numpy as np
from netCDF4 import Dataset

 path = '/home/data/Mmultic3kmNC4_msg04_201905080200.
    ...: nc'

In [78]: f=netCDF4.Dataset(path,'r')

 f.variables.keys()
Out[80]: odict_keys(['time', 'dtime', 'IR_016', 'commentaires', 'satellite', 'geos', 'ImageNavigation', 'GeosCoordinateSystem', 'Y', 'X', 'Albedo_to_Native_count_IR_016', 'IR_039', 'Temp_to_Native_count_IR_039', 'IR_087', 'Temp_to_Native_count_IR_087', 'IR_097', 'Temp_to_Native_count_IR_097', 'IR_108', 'Temp_to_Native_count_IR_108', 'IR_120', 'Temp_to_Native_count_IR_120', 'IR_134', 'Temp_to_Native_count_IR_134', 'VIS006', 'Albedo_to_Native_count_VIS006', 'VIS008', 'Albedo_to_Native_count_VIS008', 'WV_062', 'Temp_to_Native_count_WV_062', 'WV_073', 'Temp_to_Native_count_WV_073'])

In [81]: IR=f.variables['IR_108']

In [82]: IR
Out[82]: 
<class 'netCDF4._netCDF4.Variable'>
int16 IR_108(ny, nx)
    standard_name: toa_brightness_temperature
    long_name: 10.8 microns infra-red channel MSG Imager
    units: K
    scale_factor: 0.01
    add_offset: 273.15
    valid_min: -27315
    valid_max: 32767
    _FillValue: -32768
    available: yes
    comment: channel 9
    nuc: 931.122
    alpha: 0.9983
    beta: 0.6256
    CalibrationParametersOrigin: rttov
    _CoordinateSystems: GeosCoordinateSystem
    grid_mapping: GeosCoordinateSystem
    resolution: 3.0
    Offset : radiance = offset + CN x slope: -10.456819486590666
    Slope : radiance = offset + CN x slope: 0.2050356762076601
unlimited dimensions: 
current shape = (3712, 3712)
filling on

print(IR.dimensions)
('ny', 'nx')

我的第一个问题维度(nx,ny)是行和列吗?或数值对应于坐标x; y?

我想从变量IR_108的信息中了解如何在该通道中获取数值以及地理坐标X Y或lat和lon。

我有x,y(2150,525)点对应于行和列的想法,我将不得不从这些x y中提取该像素中变量的数值。例如,像素2150行525对应于值IR_108 = 4.7。 4.7是什么?

向下链接文件NetCDF4的链接。 https://drive.google.com/file/d/1IT-F7AbIx4bCjMLosjBx4F4UCoIX5DU0/view 谢谢

0 个答案:

没有答案