필터 지우기
필터 지우기

extracting variables from nc file

조회 수: 7 (최근 30일)
Tanmoyee Bhattacharya
Tanmoyee Bhattacharya 2017년 8월 17일
답변: Walter Roberson 2017년 8월 17일
I have cmip5 SPECIFIC HUMIDITY data for RCP 4.5.When I open it in matlab it is showing plev
end Size: 15x1
Dimensions: plev
Datatype: double
Attributes:
units = 'Pa'
axis = 'Z'
positive = 'down'
long_name = 'pressure'
standard_name = 'air_pressure'
there are 15 pressure level. They are 1000, 925, 850, 700, 600, 500, 400, 300, 250, 200, 150, 100, 70, 50, 30, 20, and 10 hPa; But I want only four pressure level 500,700,850 and 1000 pa. If there is any way in matlab to extract only four from nc file and save it in nc file again. The total ncdisplay is shown below
ncdisp('C:\Users\DELL\Downloads\hus_day_MPI-ESM-MR_rcp45_r1i1p1_20660101-20661231.nc');
Source:
C:\Users\DELL\Downloads\hus_day_MPI-ESM-MR_rcp45_r1i1p1_20660101-20661231.nc
Format:
classic
Global Attributes:
institution = 'Max Planck Institute for Meteorology'
institute_id = 'MPI-M'
experiment_id = 'rcp45'
source = 'MPI-ESM-MR 2011; URL: ECHAM6 (REV: 4936), T63L47; land: JSBACH (REV: 4936); ocean: MPIOM (REV: 4936), GR15L40; sea ice: 4936; marine bgc: HAMOCC (REV: 4936);'
model_id = 'MPI-ESM-MR'
forcing = 'GHG,Oz,SD,Sl,Vl,LU'
parent_experiment_id = 'historical'
parent_experiment_rip = 'r1i1p1'
branch_time = 5.7e+04
contact = 'cmip5-mpi-esm@dkrz.de'
history = 'Model raw output postprocessing with modelling environment (IMDI) at DKRZ: URL: http://svn-mad.zmaw.de/svn/mad/Model/IMDI/trunk, REV: 3914 2011-10-12T13:23:31Z CMOR rewrote data to comply with CF standards and CMIP5 requirements.'
references = 'ECHAM6: n/a; JSBACH: Raddatz et al., 2007. Will the tropical land biosphere dominate the climate-carbon cycle feedback during the twenty first century? Climate Dynamics, 29, 565-574, doi 10.1007/s00382-007-0247-8; MPIOM: Marsland et al., 2003. The Max-Planck-Institute global ocean/sea ice model with orthogonal curvilinear coordinates. Ocean Modelling, 5, 91-127; HAMOCC: Technical Documentation, http://www.mpimet.mpg.de/fileadmin/models/MPIOM/HAMOCC5.1_TECHNICAL_REPORT.pdf;'
initialization_method = 1
physics_version = 1
tracking_id = 'd62b75e6-f154-47b2-ab6e-633e03455be5'
product = 'output'
experiment = 'RCP4.5'
frequency = 'day'
creation_date = '2011-10-12T13:23:31Z'
Conventions = 'CF-1.4'
project_id = 'CMIP5'
table_id = 'Table day (27 April 2011) 86d1558d99b6ed1e7a886ab3fd717b58'
title = 'MPI-ESM-MR model output prepared for CMIP5 RCP4.5'
parent_experiment = 'historical'
modeling_realm = 'atmos'
realization = 1
cmor_version = '2.6.0'
Dimensions:
time = 365 (UNLIMITED)
plev = 15
lat = 96
lon = 192
bnds = 2
Variables:
time
Size: 365x1
Dimensions: time
Datatype: double
Attributes:
bounds = 'time_bnds'
units = 'days since 1850-1-1 00:00:00'
calendar = 'proleptic_gregorian'
axis = 'T'
long_name = 'time'
standard_name = 'time'
time_bnds
Size: 2x365
Dimensions: bnds,time
Datatype: double
plev
Size: 15x1
Dimensions: plev
Datatype: double
Attributes:
units = 'Pa'
axis = 'Z'
positive = 'down'
long_name = 'pressure'
standard_name = 'air_pressure'
lat
Size: 96x1
Dimensions: lat
Datatype: double
Attributes:
bounds = 'lat_bnds'
units = 'degrees_north'
axis = 'Y'
long_name = 'latitude'
standard_name = 'latitude'
lat_bnds
Size: 2x96
Dimensions: bnds,lat
Datatype: double
lon
Size: 192x1
Dimensions: lon
Datatype: double
Attributes:
bounds = 'lon_bnds'
units = 'degrees_east'
axis = 'X'
long_name = 'longitude'
standard_name = 'longitude'
lon_bnds
Size: 2x192
Dimensions: bnds,lon
Datatype: double
hus
Size: 192x96x15x365
Dimensions: lon,lat,plev,time
Datatype: single
Attributes:
standard_name = 'specific_humidity'
long_name = 'Specific Humidity'
units = '1'
cell_methods = 'time: mean'
cell_measures = 'area: areacella'
missing_value = 1e+20
_FillValue = 1e+20
associated_files = 'baseURL: http://cmip-

채택된 답변

Walter Roberson
Walter Roberson 2017년 8월 17일
Extract the stored pressure levels. Then use
mask = ismember(plev, [500, 700, 850, 1000]);
then
hus_subset = hus(:, :, mask, :);
Now you can create a new (or updated) nc file containing the subset.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by