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

3 visualizaciones (últimos 30 días)
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'

Respuesta aceptada

Austin M. Weber
Austin M. Weber el 2 de Dic. de 2021
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;

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by