- 积分
- 26283
- 贡献
-
- 精华
- 在线时间
- 小时
- 注册时间
- 2012-6-1
- 最后登录
- 1970-1-1
|
登录后查看更多精彩内容~
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
按照清风版主的帖子,我已经把一个文件夹目录下的nc文件名称全部读到了dir.txt,程序如下所示:
program main
character(200) aaaa
character(200) buffer
integer n,i
n=64
open(1,file='d:/data/dir.txt',access="sequential", status="old")
do 10,i=1,n,1
read(1, fmt="(A79)") aaaa
open(2,file=aaaa,access="sequential", status="old")
read(2, fmt="(A79)") buffer
print*,aaaa
10 continue
close(1)
end
以上都可以成功实现。
现在的问题是每一个nc文件之中有如下变量及其信息如下所示:
Source:
D:\data\2\pottmp.sig995.1948.nc
Format:
classic
Global Attributes:
Conventions = 'COARDS'
title = '4x daily NMC reanalysis (1948)'
history = 'created 99/05/11 by Hoop (netCDF2.3)'
description = 'Data is from NMC initialized reanalysis
(4x/day). These are the 0.9950 sigma level values.'
platform = 'Model'
references = 'http://www.esrl.noaa.gov/psd/data/gridded/data.ncep.reanalysis.html'
Dimensions:
lon = 144
lat = 73
time = 1464 (UNLIMITED)
Variables:
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: 1464x1
Dimensions: time
Datatype: double
Attributes:
units = 'hours since 1-1-1 00:00:0.0'
long_name = 'Time'
actual_range = [1.71e+07 1.71e+07]
delta_t = '0000-00-00 06:00:00'
standard_name = 'time'
axis = 'T'
pottmp
Size: 144x73x1464
Dimensions: lon,lat,time
Datatype: int16
Attributes:
long_name = '4xDaily potential temperature at sigma level 995'
unpacked_valid_range = [1.50e+02 9.00e+02]
actual_range = [1.98e+02 3.41e+02]
units = 'degK'
add_offset = 3.43e+03
scale_factor = 0.1
missing_value = 3.28e+04
precision = 1
least_significant_digit = 1
GRIB_id = 13
GRIB_name = 'POT'
var_desc = 'Potential Temperature'
dataset = 'NMC Reanalysis'
level_desc = 'Surface'
statistic = 'Individual Obs'
parent_stat = 'Other'
valid_range = [-3.28e+04 -2.53e+04]
我的问题是,在上面的fortran程序之中,我应该如何把不同的变量进行处理呢?我想把对每一个格点的数据进行统计,超过一定阈值如5,就计数,不超过5就不计数。并把最终的计数放在相应的格点。现在还不是很清楚,如何把nc文件中的变量在fortran程序之中单独赋给变量或者数组。然后对这些变量和数组进行操作。最终输出几个维度的文件:a(lon,lat,time,poptmp),或者单独一个变量一个信息如b(lat),c(lon)……,不知道大家有没有例子或者提供建议。
看了很多帖子,发现很少有读取文件名之后,接下来的操作的帖子。
请大家帮忙,提供一个参考的例子。
谢谢!
|
|