How can I extract the 'missing_value' from a variable in a NetCDF file?

3 ビュー (過去 30 日間)
Austin M. Weber
Austin M. Weber 2021 年 12 月 2 日
回答済み: Austin M. Weber 2021 年 12 月 2 日
I have a NetCDF (.nc) file containing evapotranspiration data. I want to extract the value from the 'missing_value' field in evavt variable. How can I do this?
I have provided the output from ncdisp(filename) below that contains the relevant information. For the purpose of this question, my .nc file is saved as the variable 'filename' without the quotes. Thank you for your help!
ncdisp(filename)
...
Variables:
longitude
Size: 3600x1
Dimensions: longitude
Datatype: single
Attributes:
units = 'degrees_east'
long_name = 'longitude'
latitude
Size: 1001x1
Dimensions: latitude
Datatype: single
Attributes:
units = 'degrees_north'
long_name = 'latitude'
time
Size: 732x1
Dimensions: time
Datatype: int32
Attributes:
units = 'hours since 1900-01-01 00:00:00.0'
long_name = 'time'
calendar = 'gregorian'
evavt
Size: 3600x1001x732
Dimensions: longitude,latitude,time
Datatype: int16
Attributes:
scale_factor = 2.1373e-07
add_offset = -0.0059507
_FillValue = -32767
missing_value = -32767
units = 'm of water equivalent'
long_name = 'Evaporation from vegetation transpiration'

採用された回答

Austin M. Weber
Austin M. Weber 2021 年 12 月 2 日
Actually, it looks like I figured it out for myself!
% Get structure of .nc file data
info = ncinfo(filename);
% Extract missing value
missing_value = info.Variables(4).Attributes(4).Value;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNetCDF についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by