[Wrf-users] How to crop a wrfout file

Alex Fierro alexandre.o.fierro at gmail.com
Tue Jun 12 12:41:50 MDT 2018


Hello:

Given that NCL is notoriously slow at handling large IO files, you can also
pre-process the wrfout files with a Fortran program using the NETCDF
built-in functions ("use netcdf" and compile with appropriate netcdf
libs/include files) such as:

! get v ID
      status = NF90_INQ_VARID(ncid,'V',variddat)
      if (status /= nf90_noerr) call handle_err(status)
! get v array
      status =
NF90_GET_VAR(ncid,variddat,vv,start=(/nxstart,nystart,1/),stride=(/xstride,ystride,zstride/))
      if (status /= nf90_noerr) call handle_err(status)

In NF90_GET_VAR() you can either specify a start-end point for each
dimension and/or use striding. Another way of reducing the IO size at
runtime is to remove unwanted variables in the namelist (function of
maxdom) via the flag:

&time_control
...
iofields_filename                   = "my_iofields_list.txt",
"my_iofields_list.txt"


where:

> cat my_iofields_list.txt

-:h:0:glw,pot,vt_dbz_wt,rainsh,tlwdn,tlwup,slwdn,slwup,tswdn,tswup,sswdn,sswup,p_hyd,sciona,sh2o,smcrel,tke_pbl,tslb,cldfra,el_pbl,qnccn,qncloud,qnrain,qnhail,qngraupel,qnice,qvgraupel,qnsnow,smois,acgrdflx,achfx,aclhf,albbck,albedo,avg_fuel_frac,canwat
-:h:0:cosalpha,e,emiss,f,graupelnc,grdflx,hailnc,hml,huml,hvml,isltyp,ivgtyp,lai,lu_index,mapfac_m,mapfac_mx,mapfac_my,mapfac_u,mapfac_ux,mapfac_uy,mapfac_v,mapfac_vx,mapfac_vy,mf_vx_inv,nest_pos,noahres,mu,mub,olr,pblh,q2,seaice,sfroff,sinalpha,snopcx
-:h:0:snow,snowc,snowh,snownc,soiltb,sr,sstsk,swdown,swnorm,t0ml,t2,th2,tml,tmn,tmoml,tsk,uah,udroff,up_heli_max,ust,vah,vegfra,xicem,xland,xlat_u,xlat_v,xlong_u,xlong_v,h0ml,clnox

Cheers and hope this helps,

Alex-


-------------------------------------------------------------
Alexandre Fierro, PhD
Research Scientist-
National Severe Storms Laboratory (NSSL/NOAA)
*The Cooperative Institute for Mesoscale Meteorological Studies* (OU/NOAA)

"Yesterday is History, Tomorrow is a Mystery and Today is a Gift; That is
why it is called the Present"

"There are only 10 types of people in the world:
Those who understand binary, and those who don't"

"My opinions are my own and not representative of OU, NSSL,
AOML, HRD, LANL or any affiliates."
         ^.^
       (o  o)
     /(   V   )\
   ---m---m----

On 12 June 2018 at 12:56, Barry Lynn <barry.h.lynn at gmail.com> wrote:

> Hi:
>
> Are you aware that you can write some of the wrf output variables to an
> external file?
>
> ;---Write variables to file
>
>
> Note, the names on the right are obtained with wrf_user..., for example:
>
>
> slp = wrf_user_getvar(a,"slp",it)
>
>
> (remove the ;)
>
> ;     system("rm -f file_for_you.nc")
>
> ;     fout = addfile("file_for_you.nc","c")
>
> ;     fout->pett_fgen = pett_fgen
>
> ;     fout->z_plane   = z_plane
>
> ;     fout->xlat      = xlat
>
> ;     fout->xlong     = xlong
>
>
> On Tue, Jun 12, 2018 at 5:37 PM M Mortezapour <mortezapour88 at gmail.com>
> wrote:
>
>> Hello,
>>
>> I have some wrfout files that I should use them in another program, but
>> they are too large. I need to crop a small part of them. I've searched a
>> lot, but I couldn't find an efficient way. Any help would be appreciated.
>>
>> Thanks,
>> Mari
>> _______________________________________________
>> Wrf-users mailing list
>> Wrf-users at ucar.edu
>> http://mailman.ucar.edu/mailman/listinfo/wrf-users
>>
>
>
> --
> Barry H. Lynn, Ph.D
> Senior Lecturer,
> The Institute of the Earth Science,
> The Hebrew University of Jerusalem,
> Givat Ram, Jerusalem 91904, Israel
> Tel: 972 547 231 170
> Fax: (972)-25662581
>
> C.E.O, Weather It Is, LTD
> Weather and Climate Focus
> http://weather-it-is.com
> Jerusalem, Israel
> Local: 02 930 9525
> Cell: 054 7 231 170
> Int-IS: x972 2 930 9525
> US 914 432 3108
>
> _______________________________________________
> Wrf-users mailing list
> Wrf-users at ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/wrf-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/wrf-users/attachments/20180612/f2dae8af/attachment-0001.html>


More information about the Wrf-users mailing list