Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Precipitation map with RAINC and RAINNC (WRF model output)

Chetan

New member
One more question, @Ming Chen
So far I am using ERA5 to initialize the WRF.
But, i have a confusion about GFS data.
I found the following list of data from NCAR RDA Dataset ds084.1.
gfs.0p25.2015011500.f000.grib2
gfs.0p25.2015011500.f003.grib2
gfs.0p25.2015011500.f006.grib2
.
.
.
gfs.0p25.2015011500.f384.grib2

And ,then

gfs.0p25.2015011506.f000.grib2
gfs.0p25.2015011506.f003.grib2
gfs.0p25.2015011506.f006.grib2
.
.
.
gfs.0p25.2015011506.f384.grib2

and so on..


To do a model simulation for 1 day, for example: 20150115,
which set of gfs data do i need to download, the bold one, gfs.0p25.2015011500.f000.grib2, gfs.0p25.2015011506.f000.grib2, gfs.0p25.2015011512.f000.grib2............... or the forecasted one
gfs.0p25.2015011500.f000.grib2, gfs.0p25.2015011500.f003.grib2, gfs.0p25.2015011500.f006.grib2 ,............... ??

And what is the difference between the above two choice of dataset? (One difference will be interval, 3hr vs 6hr)
Does the model output will with the choice of these datasets?
 

Chetan

New member
This indicates that WRF overestimates precipitation. Does such kind of overestimation appear everywhere?
I didn't check it. I focused on the location where I am interested as well as did the domain average. In both cases, WRF overestimates the observation rain rate. Here I am using ERA5 to initialize the model.
 

fathima anan

New member
I am new to NCL, I need to extract accum rainfall for 24 hours which starts from 16 th hour to 39 th hour from WRF output, i dont know the correct way of extracting only the desirable time period.
rain_tot_tend = rain_tot(16:39,ystart:yend,xstart:xend)
rain_tot_tend!0 = "latitude"
rain_tot_tend!1 = "longitude"
could I extract directly like this ?
 

Ming Chen

Moderator
Staff member
How did you define the variable rain_tot? I am confused by Its dimensions, i.e., what are ystart:yend, xstart:xend ?
 

fathima anan

New member
this is my code
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"


; First things first, Let's define input files

csv_file = "./M29_OBS_CUM_RAIN_24.csv"

f4 = asciiread(csv_file, -1, "string") ; -1 is used to read variables as 1 dimensional

trg_id = toint(str_get_field(f4(1:), 1, ","))
st_lats = tofloat(str_get_field(f4(1:), 2, ","))
st_lons = tofloat(str_get_field(f4(1:), 3, ","))
RAIN = tofloat(str_get_field(f4(1:), 8, ","))
;print(trg_id)
;print(RAIN)

wrf_file = addfile("wrfout_d03_2018-05-28_12:00:00.nc", "r")

;------------------Area to zoom in on
lats = (/ 11, 19/)
lons = (/74,79/)
loc = wrf_user_ll_to_xy(wrf_file, lons, lats, True)

xstart = loc(0,0) ; Set the zoom in coordinates
xend = loc(0,1)
ystart = loc(1,0)
yend = loc(1,1)

alat = wrf_file ->XLAT(0,ystart:yend,xstart:xend)
alon = wrf_file ->XLONG(0,ystart:yend, xstart:xend)


wlat = wrf_file ->XLAT(0,ystart:yend,0)
wlon = wrf_file ->XLONG(0,0, xstart:xend)

;print(wlon)

; Calculate total precipitation
rain_exp = wrf_user_getvar(wrf_file,"RAINNC",-1)
rain_con = wrf_user_getvar(wrf_file,"RAINC",-1)
rain_tot = rain_exp + rain_con


rain_tot_tend = rain_tot(16:39,ystart:yend,xstart:xend)
rain_tot_tend!0 = "latitude"
rain_tot_tend!1 = "longitude"

;printVarSummary(rain_tot_tend)

rain_grid = triple2grid2d(st_lons,st_lats,RAIN,alon,alat,False)
rain_grid!0 = "latitude"
rain_grid!1 = "longitude"
;printVarSummary(rain_grid)


;;;;;;;;;;;; Creat NetCDF file;;;;;;;;;;

fileout = "./M29_OBS_CUM_RAIN"
print(fileout)

setfileoption("nc", "Format", "NetCDF4")
fn = fileout+".nc"

system("/bin/rm -f " + fn) ; remove if exists
f = addfile(fn, "c")

;===================================================================
; explicitly declare file definition mode. Improve efficiency.
setfileoption(f,"DefineMode",True)

;Create some file attributes
fAtt = True ; assign file attributes
fAtt@title = "NCL generated netCDF file with multiple unlimited dimensions"
fAtt@source_file = fn
fAtt@creation_date = systemfunc ("date")

fileattdef(f, fAtt)

;===================================================================
;Define the file dimensions, NOTE that both dimensions are unlimited.
dimNames = (/"longitude", "latitude"/)
dimSizes = (/ -1, -1/)
dimUnlim = (/ True, True/)
filedimdef(f, dimNames, dimSizes, dimUnlim)


ny = dimsizes(wlon)
nx = dimsizes(wlat)
;print(nx)
;print(ny)

;===================================================================
;Generate time and space coordinate variable.
longitude = wlon
longitude@name = "longitude"
longitude!0 = "longitude"
filevardef(f, "longitude", typeof(longitude), getvardims(longitude))
filevarattdef(f,"longitude", longitude)

latitude = wlat
latitude@name = "latitude"
latitude!0 = "latitude"
filevardef(f, "latitude", typeof(latitude), getvardims(latitude))
filevarattdef(f,"latitude", latitude)
;===========================================================

wrain = new((/nx, ny/), float)
wrain@name = "wrf rainfall"
wrain!0 = "latitude"
wrain!1 = "longitude"
filevardef(f, "wrain", typeof(wrain), getvardims(wrain))
filevarattdef(f,"wrain", wrain)

do i = 0, nx - 1
do j = 0, ny-1
wrain(i, j) = rain_tot_tend(i,j)
end do
end do


;===========================================================

stnrain = new((/nx, ny/), float)
stnrain@name = "station rainfall"
stnrain!0 = "latitude"
stnrain!1 = "longitude"
filevardef(f, "stnrain", typeof(stnrain), getvardims(stnrain))
filevarattdef(f,"stnrain", stnrain)

do i = 0, nx - 1
do j = 0, ny-1
stnrain(i, j) = rain_grid(i,j)
end do
end do


;Write the data out.
f->latitude = (/latitude/)
f->longitude = (/longitude/)
f->wrain = (/wrain/)
f->stnrain = (/stnrain/)
 
Last edited:

Ming Chen

Moderator
Staff member
rain_tot = rain_exp + rain_con gives total accumulative rainfall, which is a 2D array if (ny, nx)

Therefore, the following piece of code doesn't make sense.

rain_tot_tend = rain_tot(16:39,ystart:yend,xstart:xend)
rain_tot_tend!0 = "latitude"
rain_tot_tend!1 = "longitude"

Please consult NCL people for more help. The email is ncl-talk@ucar.edu.
 

annubhav884

New member
I have generated the wrf output at 3 hours interval from 14th-Aug-2023 to 22nd-Aug-2023, I need 24 hours precipitation values (daily rainfall), I calculated using the simple maths like : ( RAINNC + RAINC ) at [x+8] hours - (RAINNC + RAINC) at x hours. I have tried alot to generate the output for different dates and times as well. What I always observe is all of my rainnc values are like between 0 and 1. For example : 0.0004585, 5.1564e-6, 0.0000455 etc. But the actual values are like 4.26, 1.55, 6.689 and so on. What could be the possible reason for these smaller values ?
 

annubhav884

New member
Have you looked at the accumulated value, i.e., rainnc in your wrfout files? Does it look reasonable?
Yes, for all dates and times I have generated the wrfout file and looked at the values of rainnc and rainc using console by trying out random latitude, longitude, time indexes. Also, I printed all the values of rainnc using 3 nested for loops for 3 dimensional rainnc values. But every time, I get similar values like mentioned above. For example : 0.0004585, 5.1564e-6, 0.0000455 etc.

This is my namelist.wps file (only dates are different in this case) :
&share
wrf_core = 'ARW',
max_dom = 1,
start_date = '2023-08-15_00:00:00',
end_date = '2023-09-08_00:00:00',
interval_seconds = 86400,
io_form_geogrid = 2,
/

&geogrid
parent_id = 1,
parent_grid_ratio = 1,
i_parent_start = 1,
j_parent_start = 1,
s_we = 1,
s_sn = 1,
e_we = 100,
e_sn = 100,
dx = 10000,
dy = 10000,
map_proj = 'lambert',
truelat1 = 15.0,
truelat2 = 22.0,
stand_lon = 73.78,
ref_lat = 20.00,
ref_lon = 73.78,
geog_data_res = 'default',
geog_data_path = '/root/WRF/WPS_GEOG'
/

&ungrib
prefix = 'GFS',
out_format = 'WPS'
/

&metgrid
fg_name = 'GFS'
io_form_metgrid = 2
/

This is my namelist.inputfile (only dates are different in this case) :
&time_control
run_days = 24,
run_hours = 0,
run_minutes = 0,
run_seconds = 0,
start_year = 2023,
start_month = 08,
start_day = 15,
start_hour = 00,
end_year = 2023,
end_month = 09,
end_day = 08,
end_hour = 00,
interval_seconds = 86400,
input_from_file = .true.,
history_interval = 180,
frames_per_outfile = 1000,
restart = .false.,
restart_interval = 3600,
io_form_history = 2
io_form_restart = 2
io_form_input = 2
io_form_boundary = 2
/

&domains
time_step = 60,
time_step_fract_num = 0,
time_step_fract_den = 1,
max_dom = 1,
s_we = 1,
s_sn = 1,
e_we = 100,
e_sn = 100,
e_vert = 33,
p_top_requested = 5000,
num_metgrid_levels = 34,
num_metgrid_soil_levels = 4,
dx = 10000,
dy = 10000,
feedback = 1,
smooth_option = 0,
/

&physics
physics_suite = 'CONUS'
mp_physics = -1,
cu_physics = -1,
ra_lw_physics = -1,
ra_sw_physics = -1,
bl_pbl_physics = -1,
sf_sfclay_physics = -1,
sf_surface_physics = -1,
radt = 30,
bldt = 0,
cudt = 5,
icloud = 1,
num_land_cat = 21,
sf_urban_physics = 0,
/

&fdda
/

&dynamics
hybrid_opt = 2,
w_damping = 0,
diff_opt = 1,
km_opt = 4,
diff_6th_opt = 0,
diff_6th_factor = 0.12,
base_temp = 290.
damp_opt = 3,
zdamp = 5000.,
dampcoef = 0.2,
khdif = 0,
kvdif = 0,
non_hydrostatic = .true.,
moist_adv_opt = 1,
scalar_adv_opt = 1,
gwd_opt = 1,
/

&bdy_control
spec_bdy_width = 5,
specified = .true.
/

&grib2
/

&namelist_quilt
nio_tasks_per_group = 0,
nio_groups = 1,
/
Thanks!
 
Top