help with scripts for wrfout

Questions relating to the use of the WRF Post Processor V3

help with scripts for wrfout

Postby Mauricio_S » Thu Jun 04, 2015 8:39 pm

I must work with variables originated from WRF, i'm seeing how the climate change affects the pavements design in Chile,
because of that it was made a climate prediction for the period 2030-2059, also a hincast for the period 1970-1999,
all weighting a total of 3 TB (Hincast 1.5 TB, future 1.5 TB).
I need to extract certain variables from the wrftout files (temperature, wind speed, relative humidity and cloud fraction), because of that i created a script
to extract the already stated information, the variables are each 6 hours.
My problem (besides what i commented in the forum) is the script which i have it for 1 folder, the information is arranged in this way:
/hindcast/year/month, because of there are 30 year, 12 month each year (12*30=360), in total there are 360 folders (and 31 files per folder), my question is, is there a way to make the script work inside a folder
and the script automatically moves into the next folder doing its job?
PD: one of the solution i tried was leaving all the wrfout (around 11000 files overall) in one single folder and execute the script, but this collapse

The script that i have is the next one:


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/wrf/WRFUserARW.ncl"

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"


allfiles=systemfunc("ls -1 /users/yhernandez/dominiosyoska/WRFV3/run/wrfout_d03*") + ".nc"

a=addfiles(allfiles, "r")


tiempos = wrf_user_getvar(a,"times",-1)


;coordinates of the point of interest

lat = -38.7486

lon = -72.6207

point = wrf_user_ll_to_ij(a,lon,lat, True)





print("X/Y locations are: " + point)

t2 = wrf_user_getvar(a,"T2",-1)

;; t2 temperature is obtained from the point of interest

t2_point =t2(:,lat_point,lon_point)


;matrix is created with "tiempos" and "t2_point"

datatimes= new((/12,1/),string) ;the length of the variable "tiempos" is 12
datavar = new((/12,1/),float)

datatimes(:,0) = (/tiempos/)

datavar(:,0) = (/t2_point/)

lines = new(12,string)

do i = 0, 12

lines(i) = str_concat(datatimes(i,:)+" "+sprintf("%5.2f ,", datavar(i,:)))

end do




I would be really grateful if you could help me!!
Posts: 3
Joined: Thu Jun 04, 2015 10:35 am

Re: help with scripts for wrfout

Postby Beeker » Sun Aug 02, 2015 11:25 pm

Dear Mauricio_S
Actually, to extract your variables from wrf outputs you may to use the NCO tool
how to use NCO to extract your variables?
1) collect the all files in one directory.
2) create a script_file.csh contains the commands of NCO
3) the commands in the script are:
ncrcat -d Time,0,123 -v Times,XLAT,XLONG,T2,U10,V10,Q2,PSFC,CLDFRA wrfout_d01_yyyy-mm*
-O (this command yield these varibles per month)
so the script has 12(month)*30(year) lines
now you can do your statistical analysis
if you need more about the commands for statistical analysis let me know
Posts: 1
Joined: Thu Aug 16, 2012 1:24 pm

Return to WRF Post Processor V3

Who is online

Users browsing this forum: No registered users and 2 guests