Output to Grib2

Any issues with the actual running of the WRF.

Output to Grib2

Postby mt_tech » Sun Feb 18, 2018 2:58 pm

Hi,
I am trying in various ways to output WRF results to Grib2 format - but with no success.
I have changed the io_format_history variable to value =10 - the model runs but it does not create the result files. (I guess something similar to wrf_out should be produced)
Any ideas on how to make this work ?
I am attaching my namelist file:

&time_control
run_days = 0,
run_hours = 48,
run_minutes = 0,
run_seconds = 0,
start_year = YEAS, YEAS, YEAS,
start_month = MS, MS, MS,
start_day = DS, DS, DS,
start_hour = 00, 00, 00,
start_minute = 00, 00, 00,
start_second = 00, 00, 00,
end_year = YEAE, YEAE, YEAE,
end_month = ME, ME, ME,
end_day = DE, DE, DE,
end_hour = 00, 00, 00,
end_minute = 00, 00, 00,
end_second = 00, 00, 00,
interval_seconds = 21600,
input_from_file = .true., .true., .true.,
history_interval = 360, 180, 60,
frames_per_outfile = 1, 1, 1,
restart = .false.,
restart_interval = 3600,
fine_input_stream = 0, 2, ,2,
io_form_history = 10,
io_form_restart = 2,
io_form_input = 2,
io_form_boundary = 2,
debug_level = 0,
io_form_auxinput2 = 2
adjust_output_times =.true.
/

&domains
time_step = 90,
time_step_fract_num = 0,
time_step_fract_den = 1,
max_dom = 3,
e_we = 165, 166, 103,
e_sn = 130, 139, 100,
e_vert = 45, 45, 45,
p_top_requested = 5000,
num_metgrid_levels = 32,
num_metgrid_soil_levels = 4,
dx = 18000, 6000, 2000,
dy = 18000, 6000, 2000,
eta_levels = 1.000, 0.996, 0.992,
0.988, 0.982, 0.976,
0.966, 0.951, 0.936,
0.921, 0.906, 0.886,
0.866, 0.841, 0.816,
0.786, 0.761, 0.721,
0.681, 0.641, 0.601,
0.561, 0.521, 0.481,
0.441, 0.401, 0.361,
0.329, 0.299, 0.279,
0.259, 0.239, 0.219,
0.199, 0.179, 0.159,
0.139, 0.119, 0.099,
0.079, 0.059, 0.039,
0.024, 0.010, 0.000,
grid_id = 1, 2, 3,
parent_id = 1, 1, 2,
i_parent_start = 1, 59, 61,
j_parent_start = 1, 43, 51,
parent_grid_ratio = 1, 3, 3,
parent_time_step_ratio = 1, 3, 3,
feedback = 0,
smooth_option = 0
/

&physics
mp_physics = 3, 3, 3,
ra_lw_physics = 1, 1, 1,
ra_sw_physics = 1, 1, 1,
radt = 18, 18, 18,
sf_sfclay_physics = 2, 2, 2,
sf_surface_physics = 2, 2, 2,
bl_pbl_physics = 2, 2, 2,
bldt = 0, 0, 0,
cu_physics = 1, 1, 1,
cudt = 5, 5, 5,
isfflx = 1,
ifsnow = 0,
icloud = 1,
surface_input_source = 1,
num_soil_layers = 4,
sf_urban_physics = 0, 0, 0,
maxiens = 1,
maxens = 3,
maxens2 = 3,
maxens3 = 16,
ensdim = 144,
/

&fdda
/

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

&bdy_control
spec_bdy_width = 5,
spec_zone = 1,
relax_zone = 4,
specified = .true., .false.,.false.,
nested = .false., .true., .true.,
/

&grib2
background_proc_id = 255,
forecast_proc_id = 255,
production_status = 255,
compression = 40,
/

&namelist_quilt
nio_tasks_per_group = 0,
nio_groups = 1,
/
mt_tech
 
Posts: 4
Joined: Sun Jan 28, 2018 9:22 am

Re: Output to Grib2

Postby dimch » Mon Feb 25, 2019 1:03 am

Hi, I am also trying to get WRF v4.0 output history in GRIB2 format. I have not succeeded in getting valid GRIB2 output yet, however would like to share my experience.

First, by default WRF v4.0 is not compiled with GRIB2, so there would be no output. In rsl.error.0000 you should get lines similar to

Code: Select all
error opening wrfout_d01_2019-02-18_00:00:00 for writing. 100


In order to compile WRF with GRIB2 support you need to make several changes against the original configure.wrf. That is assuming that the variable JASPERLIB is set and is pointing to the directory that contains Jasper library file.

Code: Select all
@@ -175,6 +175,7 @@ ARCHFLAGS       =    $(COREDEFS) -DIWORDSIZE=$(IWORDSIZE) -DDWORDSIZE=$(DWORDSIZ
                       -DUSE_ALLOCATABLES \
                       -Dwrfmodel \
                       -DGRIB1 \
+                      -DGRIB2 \
                       -DINTIO \
                       -DKEEP_INT_AROUND \
                       -DLIMIT_ARGS \
@@ -208,6 +209,7 @@ CC_TOOLS_CFLAGS = -DNMM_CORE=$(WRF_NMM_CORE)
  LIB_BUNDLED     = \
                       $(WRF_SRC_ROOT_DIR)/external/fftpack/fftpack5/libfftpack.a \
                       $(WRF_SRC_ROOT_DIR)/external/io_grib1/libio_grib1.a \
+                      $(WRF_SRC_ROOT_DIR)/external/io_grib2/libio_grib2.a \
                       $(WRF_SRC_ROOT_DIR)/external/io_grib_share/libio_grib_share.a \
                       $(WRF_SRC_ROOT_DIR)/external/io_int/libwrfio_int.a \
                       $(ESMF_IO_LIB) \
@@ -216,7 +218,7 @@ CC_TOOLS_CFLAGS = -DNMM_CORE=$(WRF_NMM_CORE)
                       $(WRF_SRC_ROOT_DIR)/frame/pack_utils.o
 
  LIB_EXTERNAL    = \
-                      -L$(WRF_SRC_ROOT_DIR)/external/io_netcdf -lwrfio_nf -L/shared/wrf/LIBRARIES/netcdf/lib -lnetcdff -lnetcdf     
+                      -L$(WRF_SRC_ROOT_DIR)/external/io_netcdf -lwrfio_nf -L/shared/wrf/LIBRARIES/netcdf/lib -lnetcdff -lnetcdf  -L$(JASPERLIB) -ljasper     
 
 LIB             =    $(LIB_BUNDLED) $(LIB_EXTERNAL) $(LIB_LOCAL) $(LIB_WRF_HYDRO) $(NETCDF4_DEP_LIB)
 LDFLAGS         =    $(OMP) $(FCFLAGS) $(LDFLAGS_LOCAL)
@@ -232,7 +232,7 @@
 bundled:  io_only
 external: io_only $(WRF_SRC_ROOT_DIR)/external/RSL_LITE/librsl_lite.a gen_comms_rsllite module_dm_rsllite $(ESMF_TARGET)
 io_only:  esmf_time wrfio_nf   \
-     wrf_ioapi_includes wrfio_grib_share wrfio_grib1 wrfio_int fftpack
+     wrf_ioapi_includes wrfio_grib_share wrfio_grib1 wrfio_grib2 wrfio_int fftpack


With the above changes I am getting grib2 output however the files seem to be somehow broken.

  1. First, the file size is too small. For my domain the GRIB2 file is only 180k while the GRIB1 file is 59M.
  2. Second, wgrib2 fails to read the file and reports
    Code: Select all
    *** FATAL ERROR: inconsistent number of data points sec3: 1 sec5: 32 ***
dimch
 
Posts: 3
Joined: Tue Feb 19, 2019 2:12 am


Return to Runtime Problems

Who is online

Users browsing this forum: Bing [Bot] and 7 guests