<div dir="ltr"><div><div><div><div>Dear Mari,<br><br></div>a quiet easy and rapid way to produce a smaller netcdf would be using NCO, as Tanya just adviced. Once you install NCO, the command line to get smaller netcdf's would be:<br><br>ncrcat -O -d Time,<ini_time>,end_time> -d south_north,<nymin>,<nymax> -d west_east,<nxmin>,<nxmax> -d bottom_top,0,<maxlevels> -v Times,XLAT,XLONG,<var4>,var5>,... wrfout_in wrfout_out<br><br></div>Be aware not to include spaces where they should not be. With the option -d you cut the archive by dimension and -v selects the variables. <ini_time> and <end_time> are time steps. I recommend to include the variables Times,XLAT and XLONG in your output. <br><br></div>regards,<br><br></div>Thorsten B.<br><div><div><div class="gmail_extra"><br><div class="gmail_quote">2018-06-12 14:17 GMT-05:00  <span dir="ltr"><<a href="mailto:wrf-users-request@ucar.edu" target="_blank">wrf-users-request@ucar.edu</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send Wrf-users mailing list submissions to<br>
        <a href="mailto:wrf-users@ucar.edu">wrf-users@ucar.edu</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://mailman.ucar.edu/mailman/listinfo/wrf-users" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/wrf-users</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:wrf-users-request@ucar.edu">wrf-users-request@ucar.edu</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:wrf-users-owner@ucar.edu">wrf-users-owner@ucar.edu</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of Wrf-users digest..."<br>
<br>
<br>
Today's Topics:<br>
<br>
   1. Re: How to crop a wrfout file (Barry Lynn)<br>
   2. Re: How to crop a wrfout file (Alex Fierro)<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>----------<br>
<br>
Message: 1<br>
Date: Tue, 12 Jun 2018 20:56:02 +0300<br>
From: Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com">barry.h.lynn@gmail.com</a>><br>
To: <a href="mailto:mortezapour88@gmail.com">mortezapour88@gmail.com</a><br>
Cc: "WRF, users" <<a href="mailto:wrf-users@ucar.edu">wrf-users@ucar.edu</a>><br>
Subject: Re: [Wrf-users] How to crop a wrfout file<br>
Message-ID:<br>
        <<a href="mailto:CAN7Bv24tCMuWpAjUyn2k-PThZ6YWQNbVBe8e5tifZ4bj8EJQ%2Bw@mail.gmail.com">CAN7Bv24tCMuWpAjUyn2k-<wbr>PThZ6YWQNbVBe8e5tifZ4bj8EJQ+w@<wbr>mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hi:<br>
<br>
Are you aware that you can write some of the wrf output variables to an<br>
external file?<br>
<br>
;---Write variables to file<br>
<br>
<br>
Note, the names on the right are obtained with wrf_user..., for example:<br>
<br>
<br>
slp = wrf_user_getvar(a,"slp",it)<br>
<br>
<br>
(remove the ;)<br>
<br>
;     system("rm -f <a href="http://file_for_you.nc" rel="noreferrer" target="_blank">file_for_you.nc</a>")<br>
<br>
;     fout = addfile("<a href="http://file_for_you.nc" rel="noreferrer" target="_blank">file_for_you.nc</a>","c")<br>
<br>
;     fout->pett_fgen = pett_fgen<br>
<br>
;     fout->z_plane   = z_plane<br>
<br>
;     fout->xlat      = xlat<br>
<br>
;     fout->xlong     = xlong<br>
<br>
<br>
On Tue, Jun 12, 2018 at 5:37 PM M Mortezapour <<a href="mailto:mortezapour88@gmail.com">mortezapour88@gmail.com</a>><br>
wrote:<br>
<br>
> Hello,<br>
><br>
> I have some wrfout files that I should use them in another program, but<br>
> they are too large. I need to crop a small part of them. I've searched a<br>
> lot, but I couldn't find an efficient way. Any help would be appreciated.<br>
><br>
> Thanks,<br>
> Mari<br>
> ______________________________<wbr>_________________<br>
> Wrf-users mailing list<br>
> <a href="mailto:Wrf-users@ucar.edu">Wrf-users@ucar.edu</a><br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/wrf-users" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/wrf-users</a><br>
><br>
<br>
<br>
-- <br>
Barry H. Lynn, Ph.D<br>
Senior Lecturer,<br>
The Institute of the Earth Science,<br>
The Hebrew University of Jerusalem,<br>
Givat Ram, Jerusalem 91904, Israel<br>
Tel: 972 547 231 170<br>
Fax: (972)-25662581<br>
<br>
C.E.O, Weather It Is, LTD<br>
Weather and Climate Focus<br>
<a href="http://weather-it-is.com" rel="noreferrer" target="_blank">http://weather-it-is.com</a><br>
Jerusalem, Israel<br>
Local: 02 930 9525<br>
Cell: 054 7 231 170<br>
Int-IS: x972 2 930 9525<br>
US 914 432 3108<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/wrf-users/attachments/20180612/89e20a79/attachment-0001.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>pipermail/wrf-users/<wbr>attachments/20180612/89e20a79/<wbr>attachment-0001.html</a>><br>
<br>
------------------------------<br>
<br>
Message: 2<br>
Date: Tue, 12 Jun 2018 13:41:50 -0500<br>
From: Alex Fierro <<a href="mailto:alexandre.o.fierro@gmail.com">alexandre.o.fierro@gmail.com</a>><br>
To: Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com">barry.h.lynn@gmail.com</a>><br>
Cc: "WRF, users" <<a href="mailto:wrf-users@ucar.edu">wrf-users@ucar.edu</a>>, <a href="mailto:mortezapour88@gmail.com">mortezapour88@gmail.com</a><br>
Subject: Re: [Wrf-users] How to crop a wrfout file<br>
Message-ID:<br>
        <<a href="mailto:CA%2BGhK9tzVuKpdF%2BNUBVK7UG_P61WJSJSqNwfc0MKcctoCQfnsA@mail.gmail.com">CA+GhK9tzVuKpdF+NUBVK7UG_<wbr>P61WJSJSqNwfc0MKcctoCQfnsA@<wbr>mail.gmail.com</a>><br>
Content-Type: text/plain; charset="utf-8"<br>
<br>
Hello:<br>
<br>
Given that NCL is notoriously slow at handling large IO files, you can also<br>
pre-process the wrfout files with a Fortran program using the NETCDF<br>
built-in functions ("use netcdf" and compile with appropriate netcdf<br>
libs/include files) such as:<br>
<br>
! get v ID<br>
      status = NF90_INQ_VARID(ncid,'V',<wbr>variddat)<br>
      if (status /= nf90_noerr) call handle_err(status)<br>
! get v array<br>
      status =<br>
NF90_GET_VAR(ncid,variddat,vv,<wbr>start=(/nxstart,nystart,1/),<wbr>stride=(/xstride,ystride,<wbr>zstride/))<br>
      if (status /= nf90_noerr) call handle_err(status)<br>
<br>
In NF90_GET_VAR() you can either specify a start-end point for each<br>
dimension and/or use striding. Another way of reducing the IO size at<br>
runtime is to remove unwanted variables in the namelist (function of<br>
maxdom) via the flag:<br>
<br>
&time_control<br>
...<br>
iofields_filename                   = "my_iofields_list.txt",<br>
"my_iofields_list.txt"<br>
<br>
<br>
where:<br>
<br>
> cat my_iofields_list.txt<br>
<br>
-:h:0:glw,pot,vt_dbz_wt,<wbr>rainsh,tlwdn,tlwup,slwdn,<wbr>slwup,tswdn,tswup,sswdn,sswup,<wbr>p_hyd,sciona,sh2o,smcrel,tke_<wbr>pbl,tslb,cldfra,el_pbl,qnccn,<wbr>qncloud,qnrain,qnhail,<wbr>qngraupel,qnice,qvgraupel,<wbr>qnsnow,smois,acgrdflx,achfx,<wbr>aclhf,albbck,albedo,avg_fuel_<wbr>frac,canwat<br>
-:h:0:cosalpha,e,emiss,f,<wbr>graupelnc,grdflx,hailnc,hml,<wbr>huml,hvml,isltyp,ivgtyp,lai,<wbr>lu_index,mapfac_m,mapfac_mx,<wbr>mapfac_my,mapfac_u,mapfac_ux,<wbr>mapfac_uy,mapfac_v,mapfac_vx,<wbr>mapfac_vy,mf_vx_inv,nest_pos,<wbr>noahres,mu,mub,olr,pblh,q2,<wbr>seaice,sfroff,sinalpha,snopcx<br>
-:h:0:snow,snowc,snowh,snownc,<wbr>soiltb,sr,sstsk,swdown,swnorm,<wbr>t0ml,t2,th2,tml,tmn,tmoml,tsk,<wbr>uah,udroff,up_heli_max,ust,<wbr>vah,vegfra,xicem,xland,xlat_u,<wbr>xlat_v,xlong_u,xlong_v,h0ml,<wbr>clnox<br>
<br>
Cheers and hope this helps,<br>
<br>
Alex-<br>
<br>
<br>
------------------------------<wbr>------------------------------<wbr>-<br>
Alexandre Fierro, PhD<br>
Research Scientist-<br>
National Severe Storms Laboratory (NSSL/NOAA)<br>
*The Cooperative Institute for Mesoscale Meteorological Studies* (OU/NOAA)<br>
<br>
"Yesterday is History, Tomorrow is a Mystery and Today is a Gift; That is<br>
why it is called the Present"<br>
<br>
"There are only 10 types of people in the world:<br>
Those who understand binary, and those who don't"<br>
<br>
"My opinions are my own and not representative of OU, NSSL,<br>
AOML, HRD, LANL or any affiliates."<br>
         ^.^<br>
       (o  o)<br>
     /(   V   )\<br>
   ---m---m----<br>
<br>
On 12 June 2018 at 12:56, Barry Lynn <<a href="mailto:barry.h.lynn@gmail.com">barry.h.lynn@gmail.com</a>> wrote:<br>
<br>
> Hi:<br>
><br>
> Are you aware that you can write some of the wrf output variables to an<br>
> external file?<br>
><br>
> ;---Write variables to file<br>
><br>
><br>
> Note, the names on the right are obtained with wrf_user..., for example:<br>
><br>
><br>
> slp = wrf_user_getvar(a,"slp",it)<br>
><br>
><br>
> (remove the ;)<br>
><br>
> ;     system("rm -f <a href="http://file_for_you.nc" rel="noreferrer" target="_blank">file_for_you.nc</a>")<br>
><br>
> ;     fout = addfile("<a href="http://file_for_you.nc" rel="noreferrer" target="_blank">file_for_you.nc</a>","c")<br>
><br>
> ;     fout->pett_fgen = pett_fgen<br>
><br>
> ;     fout->z_plane   = z_plane<br>
><br>
> ;     fout->xlat      = xlat<br>
><br>
> ;     fout->xlong     = xlong<br>
><br>
><br>
> On Tue, Jun 12, 2018 at 5:37 PM M Mortezapour <<a href="mailto:mortezapour88@gmail.com">mortezapour88@gmail.com</a>><br>
> wrote:<br>
><br>
>> Hello,<br>
>><br>
>> I have some wrfout files that I should use them in another program, but<br>
>> they are too large. I need to crop a small part of them. I've searched a<br>
>> lot, but I couldn't find an efficient way. Any help would be appreciated.<br>
>><br>
>> Thanks,<br>
>> Mari<br>
>> ______________________________<wbr>_________________<br>
>> Wrf-users mailing list<br>
>> <a href="mailto:Wrf-users@ucar.edu">Wrf-users@ucar.edu</a><br>
>> <a href="http://mailman.ucar.edu/mailman/listinfo/wrf-users" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/wrf-users</a><br>
>><br>
><br>
><br>
> --<br>
> Barry H. Lynn, Ph.D<br>
> Senior Lecturer,<br>
> The Institute of the Earth Science,<br>
> The Hebrew University of Jerusalem,<br>
> Givat Ram, Jerusalem 91904, Israel<br>
> Tel: 972 547 231 170<br>
> Fax: (972)-25662581<br>
><br>
> C.E.O, Weather It Is, LTD<br>
> Weather and Climate Focus<br>
> <a href="http://weather-it-is.com" rel="noreferrer" target="_blank">http://weather-it-is.com</a><br>
> Jerusalem, Israel<br>
> Local: 02 930 9525<br>
> Cell: 054 7 231 170<br>
> Int-IS: x972 2 930 9525<br>
> US 914 432 3108<br>
><br>
> ______________________________<wbr>_________________<br>
> Wrf-users mailing list<br>
> <a href="mailto:Wrf-users@ucar.edu">Wrf-users@ucar.edu</a><br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/wrf-users" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/wrf-users</a><br>
><br>
><br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: <<a href="http://mailman.ucar.edu/pipermail/wrf-users/attachments/20180612/f2dae8af/attachment.html" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>pipermail/wrf-users/<wbr>attachments/20180612/f2dae8af/<wbr>attachment.html</a>><br>
<br>
------------------------------<br>
<br>
Subject: Digest Footer<br>
<br>
______________________________<wbr>_________________<br>
Wrf-users mailing list<br>
<a href="mailto:Wrf-users@ucar.edu">Wrf-users@ucar.edu</a><br>
<a href="http://mailman.ucar.edu/mailman/listinfo/wrf-users" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/wrf-users</a><br>
<br>
<br>
------------------------------<br>
<br>
End of Wrf-users Digest, Vol 166, Issue 6<br>
******************************<wbr>***********<br>
</blockquote></div><br></div></div></div></div>