'Ia ora na,
I've used a combination of CDO et NCO features to remap some wrfout file to wrfinput (see script below). After I compared CDO remapped file with the wrfinput from ARW feature "ndown.exe", it appeared via NCVIEW that there's a horizontal shift (zonal & meridional) between both files ; also field values are very alike, but not exactly the same (as indicated by min/max, and visually sometimes).
Please see following screenshots for PSFC (unstaggered), U10 (x-staggerd) and V10 (y-staggered). Also note that the same shift can be oserved from 3D-space variables.
I also checked the namelist.input files for both config (to be sure) : they're identical (except for the start-end dates).
Has anyone got an idea of what went wrong and where ? I suspect the problem comes from CDO being unable to handle WRF netCDF files staggered grids - hence the script below dealing with each grid one-by-one.
I could upload the WRF files I used if necessary.
Thank you
FYI : same post has been posted on CDO Forum for the local team to llok at : Horizontal shifting when interpolating WRF file with CDO remapbil (compared to ndown.exe) - CDO - Project Management Service
I've used a combination of CDO et NCO features to remap some wrfout file to wrfinput (see script below). After I compared CDO remapped file with the wrfinput from ARW feature "ndown.exe", it appeared via NCVIEW that there's a horizontal shift (zonal & meridional) between both files ; also field values are very alike, but not exactly the same (as indicated by min/max, and visually sometimes).
Please see following screenshots for PSFC (unstaggered), U10 (x-staggerd) and V10 (y-staggered). Also note that the same shift can be oserved from 3D-space variables.
I also checked the namelist.input files for both config (to be sure) : they're identical (except for the start-end dates).
Has anyone got an idea of what went wrong and where ? I suspect the problem comes from CDO being unable to handle WRF netCDF files staggered grids - hence the script below dealing with each grid one-by-one.
I could upload the WRF files I used if necessary.
Thank you
Code:
# DEFINE INPUTS
# USUALLY $1 = wrfinput_d01_2005_01 (or d02)
# USUALLY $2 = wrfoutcyril
# SELECT FIRST TIMESTEP FROM CYRILS'S WRFOUT
if [ ! -f wrfout ]
then
ncks -O -d Time,0 $2 wrfout
fi
# WRFOUT (1 timestep) ACCORDING TO T,U,V,W
ncks -v Times,MU,MUB,P,P00,PB,PSFC,P_STRAT,Q2,QCLOUD,QGRAUP,QICE,QRAIN,QSNOW,QVAPOR,SST,T,T00,T2,TH2,TSK,U10,V10,PH,PHB,W wrfout wrfout_T
ncks -v Times,U wrfout wrfout_U
ncks -v Times,V wrfout wrfout_V
# ACCORDING TO T,U,V,W
cp $1 wrfin
ncks -v Times,ALBBCK,CANWAT,CF1,CF2,CF3,CFN,CFN1,CLAT,COSALPHA,DN,DNW,DTBC,DTS,DTSEPS,E,F,FCX,FNDALBSI,FNDICEDEPTH,FNDSNOWH,FNDSNOWSI,FNDSOILW,FNM,FNP,FRC_URB2D,GCX,HGT,ISLTYP,IVGTYP,LAI,LAKE_DEPTH,LAKE_DEPTH_FLAG,LAKEFLAG,LAKEMASK,LANDMASK,LU_INDEX,MAPFAC_M,MAPFAC_MX,MAPFAC_MY,P_HYD,P_TOP,QV_BASE,RDN,RDNW,RDX,RDY,RESM,SAVE_TOPO_FROM_REAL,SEAICE,SHDMAX,SHDMIN,SINALPHA,SNOALB,SNOW,SNOWC,SNOWH,SR,STEP_NUMBER,T_BASE,T_INIT,TISO,TLP,TLP_STRAT,TMN,TOPOSLPX,TOPOSLPY,U_BASE,U_FRAME,UOCE,VAR,VAR_SSO,V_BASE,VEGFRA,V_FRAME,VOCE,XLAND,XLAT,XLONG,Z_BASE,ZETATOP,ZNU,CPLMASK,DZS,LANDUSEF,SMCREL,SMOIS,SOILCBOT,SOILCTOP,TSLB,ZNW,ZS wrfin wrfin_T
ncks -v Times,MAPFAC_U,MAPFAC_UX,MAPFAC_UY,XLAT_U,XLONG_U wrfin wrfin_U
ncks -v Times,MAPFAC_V,MAPFAC_VX,MAPFAC_VY,MF_VX_INV,XLAT_V,XLONG_V wrfin wrfin_V
# GRID DESCRIPTION
cdo griddes wrfin_T > grid_T.txt
cdo griddes wrfin_U > grid_U.txt
cdo griddes wrfin_V > grid_V.txt
# REMAP (BILINEAR)
cdo remapbil,grid_T.txt wrfout_T wrfout_T_remap
cdo remapbil,grid_U.txt wrfout_U wrfout_U_remap
cdo remapbil,grid_V.txt wrfout_V wrfout_V_remap
# CONCATENATE ALL SUB-FILES
cp wrfout_T_remap wrfout_remap
ncks -A wrfout_U_remap wrfout_remap
ncks -A wrfout_V_remap wrfout_remap
# REPLACE TIME VARIABLE TYPE AND TIME COORDINATE BY WRFIN
ncrename -d Times,Time wrfout_remap
ncks -O -s 'Times=char(Times)' wrfout_remap wrfout_remap
ncks -O -x -v Times wrfout_remap wrfout_remap
ncks -A -v Times wrfin wrfout_remap
# CHANGE XLAT* & XLONG* ATTRIBUTES
ncks -C -x -v XLONG,XLAT,XLONG_U,XLAT_U,XLONG_V,XLAT_V wrfout_remap wrfout_remap_xlonglat_ok
ncks -A -v XLONG,XLAT,XLONG_U,XLAT_U,XLONG_V,XLAT_V,HGT wrfin wrfout_remap_xlonglat_ok
# APPEND ALL REMAPPED VARIABLES TO WRFINPUT
#cp wrfin control_0
ncks -A -C -v MU wrfout_remap_xlonglat_ok wrfin
ncks -A -C -v MUB wrfout_remap_xlonglat_ok wrfin
ncks -A -C -v P wrfout_remap_xlonglat_ok wrfin
(ans so on... because I had issue with several variables I had to test each one)
# RENAME PROPERLY ACCORDING TO INPUT FILE
name="$(basename -- $1)"
cp wrfin $name
FYI : same post has been posted on CDO Forum for the local team to llok at : Horizontal shifting when interpolating WRF file with CDO remapbil (compared to ndown.exe) - CDO - Project Management Service
Attachments
Last edited: