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

(RESOLVED) Remapping / regridding of wrfinput file

Arty

Member
Hello,

I successfully remapped some wrfout variables to a wrflowinp file with CDO & NCO toolkit, but there were only 2D unstaggerd variables to interpolate.
I'm now facing an error within same CDO function "remapbil" while attempting to create a compete 2D/3D wrfinput file (1st timestep only) from a wrfout file ; it sends back :

Code:
cdo remapbil,d01.txt, wrfinput_origin.nc wrfinput_d01_2005-01
Warning (cdf_set_var): Inconsistent variable definition for XLAT_U!
Warning (cdf_set_var): Inconsistent variable definition for XLAT_V!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_U!
Warning (cdf_set_var): Inconsistent variable definition for XLONG_V!
Warning (find_time_vars): Time variable >Time< not found!

cdo remapbil (Abort): Unsupported generic coordinates (Variable: DN)!

I suppose the root cause lies in WRF netCDF incompatibilities with CF Convention ; and I don't know if there's anything to do ? Thank you to enlighten me on that matter if you have any information.
Hence I'm looking for an alternative. I'm reading NCO User Guide, but I can't figure out if the "ncremap" is what I'm looking for - does it handle WRF netCDF format ?

Have you got any other idea of what I should try ?

On a more general matter, did someone succeeded to convert WRF netCDF4 to GRIB using frozen-UPPv4.1 ?

Thanks for your help 🙏
 
Hello,

I've got some help and succeeded at regridding WRF's NetCDF. Please find below the procedure to be used :

1) Split coarse and fine files to T, U and V grids :

T grid :


Code:
ncks -v CANWAT,CLAT,COSALPHA,E,F,HGT,ISLTYP,IVGTYP,LAKEMASK,LANDMASK,LU_INDEX,MAPFAC_M,MAPFAC_MX,MAPFAC_MY,MU,MUB,P,PB,PH,PHB,PSFC,Q2,QCLOUD,QGRAUP,QICE,QRAIN,QSNOW,QVAPOR,SEAICE,SH2O,SHDMAX,SHDMIN,SINALPHA,SMCREL,SNOALB,SNOW,SNOWH,SR,SST,T,T2,TH2,TMN,TSK,U10,V10,VAR,VAR_SSO,VEGFRA,W,XLAND,XLAT,XLONG coarse_in.nc coarse_out_T.nc

ncks -v CANWAT,CLAT,COSALPHA,E,F,HGT,ISLTYP,IVGTYP,LAKEMASK,LANDMASK,LU_INDEX,MAPFAC_M,MAPFAC_MX,MAPFAC_MY,MU,MUB,P,PB,PH,PHB,PSFC,Q2,QCLOUD,QGRAUP,QICE,QRAIN,QSNOW,QVAPOR,SEAICE,SH2O,SHDMAX,SHDMIN,SINALPHA,SMCREL,SNOALB,SNOW,SNOWH,SR,SST,T,T2,TH2,TMN,TSK,U10,V10,VAR,VAR_SSO,VEGFRA,W,XLAND,XLAT,XLONG fine_in.nc fine_out_T.nc


U grid :

Code:
ncks -v U,MAPFAC_U,MAPFAC_UX,MAPFAC_UY,XLAT_U,XLONG_U coarse_in.nc coarse_out_U.nc

ncks -v MAPFAC_U,MAPFAC_UX,MAPFAC_UY,XLAT_U,XLONG_U fine_in.nc fine_out_U.nc


V grid :

Code:
ncks -v V,MAPFAC_V,MAPFAC_VX,MF_VX_INV,MAPFAC_VY,XLAT_V,XLONG_V coarse_in.nc coarse_out_V.nc

ncks -v V,MAPFAC_V,MAPFAC_VX,MF_VX_INV,MAPFAC_VY,XLAT_V,XLONG_V fine_in.nc fine_out_V.nc


2) Remap each of the new coarse grids to fine grids :

Code:
cdo griddes fine_in_T.nc > grid_T.txt
cdo remapbil,grid_T.txt coarse_out_T.nc fine_out_T_remap.nc

cdo griddes fine_in_U.nc > grid_U.txt
cdo remapbil,grid_U.txt coarse_out_U.nc fine_out_U_remap.nc

cdo griddes fine_in_V.nc > grid_V.txt
cdo remapbil,grid_V.txt coarse_out_V.nc fine_out_V_remap.ncundefined

3) Concatenate T, U and V remapped fine grids together :

Code:
cp fine_out_T_remap.nc fine_out_all_remap.nc
ncks -A fine_out_U_remap.nc fine_out_all_remap.nc
ncks -A fine_out_V_remap.nc fine_out_all_remap.nc

4) Add time (because CDO converts time format) :

Code:
ncrename -d time,Time fine_out_all_remap.nc
ncks -A -v Times fine_in.nc fine_out_all_remap.nc
 
Last edited:
Top