At NetCDF to text i find some build in tool to get data from Netcdf files and export it to ASCII file. But no idea how to use it for my requirement?
How to convert .NetCDF reterive from NCEP/NCAR to ASCII files of each month
2 ビュー (過去 30 日間)
古いコメントを表示
I have air.mon.mean.nc file prepared by NCEP/NCAR. This file contain monthly temperature. I want to get temperature data in text file for each month since 1985 to 2015.
When i try ncdisp('air.mon.mean.nc')
I got
Source:
E:\meta data\new\data _thesis\NCEP\.Net files\air.mon.mean.nc
Format:
netcdf4_classic
Global Attributes:
description = ' Data from NCEP initialized reanalysis (4x/day). These are interpolated to pressure surfaces from model (sigma) surfaces.'
platform = 'Model'
Conventions = 'COARDS'
NCO = '20121012'
history = 'Mon Jul 5 21:45:36 1999: ncrcat air.mon.mean.nc /Datasets/ncep.reanalysis.derived/pressure/air.mon.mean.nc /dm/dmwork/nmc.rean.ingest/combinedMMs/air.mon.mean.nc
/home/hoop/crdc/cpreanjuke2farm/cpreanjuke2farm Tue Oct 17 20:07:08 1995 from air.85.nc
created 95/02/06 by Hoop (netCDF2.3)
Converted to chunked, deflated non-packed NetCDF4 2014/09'
title = 'monthly mean air from the NCEP Reanalysis'
References = 'http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.derived.html'
Dimensions:
level = 17
lat = 73
lon = 144
time = 818 (UNLIMITED)
Variables:
level
Size: 17x1
Dimensions: level
Datatype: single
Attributes:
units = 'millibar'
long_name = 'Level'
positive = 'down'
GRIB_id = 100
GRIB_name = 'hPa'
actual_range = [1.00e+03 1.00e+01]
axis = 'Z'
lat
Size: 73x1
Dimensions: lat
Datatype: single
Attributes:
units = 'degrees_north'
actual_range = [9.00e+01 -9.00e+01]
long_name = 'Latitude'
standard_name = 'latitude'
axis = 'Y'
lon
Size: 144x1
Dimensions: lon
Datatype: single
Attributes:
units = 'degrees_east'
long_name = 'Longitude'
actual_range = [0.00e+00 3.58e+02]
standard_name = 'longitude'
axis = 'X'
time
Size: 818x1
Dimensions: time
Datatype: double
Attributes:
long_name = 'Time'
delta_t = '0000-01-00 00:00:00'
avg_period = '0000-01-00 00:00:00'
prev_avg_period = '0000-00-01 00:00:00'
standard_name = 'time'
axis = 'T'
units = 'hours since 1800-01-01 00:00:0.0'
actual_range = [1.30e+06 1.89e+06]
air
Size: 144x73x17x818
Dimensions: lon,lat,level,time
Datatype: single
Attributes:
long_name = 'Monthly Mean of Air temperature'
units = 'degC'
precision = 2
least_significant_digit = 1
var_desc = 'Air Temperature'
level_desc = 'Multiple levels'
statistic = 'Mean'
parent_stat = 'Other'
missing_value = -9.97e+36
valid_range = [-2.00e+02 3.00e+02]
dataset = 'NCEP Reanalysis Derived Products'
actual_range = [-1.09e+02 4.32e+01]
>>
These are my inputs to dimensions in nc files.
time: 444(means for January 1985 and it will be 445 for February 1985 and soon on till 2015)
Level: 0:1:16 (remains same in each file)
Lat:21:1:28 (remains same in each file)
Lon:24:1:31 (remains same in each file)
Save these text files in name like jan, feb,march,aparil,.....dec and make a folder with name of each year like 1985, 1986,1987...2015 where this code save monthly text files of the same year.
At end i have 30 folders(from 1985 to 2015) and 12 text files exporting from nc file in each folder.
My nc file exceeding 5Mb upload size that why i am sharing link NCEP/NCAR where i download my air.mon.mean.nc file. and i am using Rmatlab2013b version of matlab.
output text files for 1985 has been attached remaining are just like of that. Please help!
5 件のコメント
採用された回答
KSSV
2016 年 3 月 15 日
Reading nc file is very easy in MATLAB. Use ncdisp('air.mon.mean.nc') to view the contents of the file. ncdisp shows you variables, dimensions of the file. After looking into variables, you can read what ever the variable you want. To read longitude and latitude: lon = ncread('air.mon.mean.nc','Lon') ; % Lon is variable as given above lat = ncread('air.mon.mean.nc','Lat') ; % LAt is variable as given above
Like wise using ncread you can read all the variables. Once you have the data in workspace, you can write it into any format you want.
8 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で NetCDF についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!