; -------------- LOAD FUNCTIONS AND PROCEDURES ----------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
begin
; ------------------read wrfout file-------------------
dir = "/public/lapc/Tgq/environment/WRF/data/wrfout/20180101/"
files = systemfunc("ls " + dir + "wrfout_d03_2018-01-01_00:00:00")
a = addfiles(files,"r")
;a = addfiles("/home/jina/Build_WRF/WRF输出文档/(2021-09-15)2006-04-01~31号/wrfout_d03_2006-04-01_00:00:00" ,"r")
; Process all the time steps
times = wrf_user_list_times(a) ; get all times in the file
ntimes = dimsizes(times) ; number of times in the file
; -----------read Wind\temperature\dew point temperature\pressure\Height
u_ph = wrf_user_getvar(a,"U10",-1) ; u averaged to mass points
v_ph = wrf_user_getvar(a,"V10",-1) ; v averaged to mass points
tch=wrf_user_getvar(a, "tc",-1)
tdh=wrf_user_getvar(a, "td",-1); td(ntim,nlvl,nlat,nlon)
;---------------- Select set station lon,lat,fixed height(from surface(m))[CHANGE HERE]-----------------------------
Latitude = 36.67
Longitude = 117
;------------------------------------------------------------------
res = True
res@returnInt = True ; False : return real values, True: return interger values
point = wrf_user_ll_to_ij(a,Longitude,Latitude,res) ; wrf_user_ll_to_ij(nc_file,lon,lat,opt)
point =point -1
x = point(0)
y = point(1)
print("X location is: " + x) ; print the value of X at the screen
print("Y location is: " + y) ; print the value of Y at the screen
nheight = conform(height,ter,(/0,2,3/)) ; assuming height is a 3d array and ter is a 2d array
height = height - nheight
; ------ WRITE IN FILE --------------- *
npts=ntimes
fName = "结果_提取10米高度(气压、露点、温度、风向、风速).txt" ;FILENAME
data = new( npts, "string") ;OUTPUTDATE
print(" 时间 气压 露点温度 温度 风向 风速 ")
print ( times+sprintf("%12.1f",phc/100)+sprintf("%12.1f",tdc)+ sprintf("%12.1f",tcc)+sprintf("%12.0f",winddirh)+sprintf("%12.1f", windspdh) )
data = times +sprintf("%12.1f",phc/100)+sprintf("%12.1f",tdc)+ sprintf("%12.1f",tcc)+sprintf("%12.0f",winddirh)+sprintf("%12.1f", windspdh)
asciiwrite (fName,data)
end
报错信息为: [Tgq@mgmt02 20180101]$ ncl newextract10m.ncl Copyright (C) 1995-2017 - All Rights Reserved University Corporation for Atmospheric Research NCAR Command Language Version 6.4.0 The use of this software is governed by a License Agreement. See http://www.ncl.ucar.edu/ for more details. fatal:syntax error: line 1 in file newextract10m.ncl before or near