Re: regridding of ECMWF to WRF grid

From: David Jones <jonesd647_at_nyahnyahspammersnyahnyah>
Date: Sun Jan 27 2013 - 12:39:39 MST

You could also try using the NCL function "rgrid2rcm" like in the script below. I've used this for ERA-I data before. Dave. ====================================================== ; interpolation script load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" begin wrf_grid = addfile("wrfout_d01_2001-12-24_00:00:00.nc","r") lat2d = wrf_grid->XLAT(0,:,:) lon2d = wrf_grid->XLONG(0,:,:) files = asciiread("erai_files.asc",-1,"string") ; -1 for all print(files) erai_grid = addfiles(files,"r") t2m      = erai_grid[:]->2T_GDS4_SFC(:,:,:) printVarSummary(t2m) t2m      = t2m(:,::-1,:)    ; INVERT LATITUDES FOR rgrid2rcm printVarSummary(t2m) g4_lat_1 = erai_grid[:]->g4_lat_1(:) printVarSummary(g4_lat_1) g4_lat_1 = g4_lat_1(::-1) printVarSummary(g4_lat_1) g4_lon_2 = erai_grid[:]->g4_lon_2(:) f = addfile("t2m_erai-wrfgrid.nc","c")   ; Create blank file to write to ;xgrd = rgrid2rcm(x&lat, x&lon, x, lat2d, lon2d, 0) xgrd = rgrid2rcm_Wrap(t2m&g4_lat_1, t2m&g4_lon_2, t2m, lat2d, lon2d, 0) xgrd!0    = "Time"    ; restore meta data xgrd!1    = "south_north" xgrd!2    = "west_east" printVarSummary(xgrd) filedimdef(f,"time",-1,True) f->T2M = xgrd(:,:,:) end ===================================================== ________________________________ From: "ncl-talk-request_at_ucar.edu" <ncl-talk-request_at_ucar.edu> To: ncl-talk_at_ucar.edu Sent: Sunday, January 27, 2013 8:00:04 PM Subject: ncl-talk Digest, Vol 110, Issue 33 Send ncl-talk mailing list submissions to     ncl-talk_at_ucar.edu To subscribe or unsubscribe via the World Wide Web, visit     http://mailman.ucar.edu/mailman/listinfo/ncl-talk or, via email, send a message with subject or body 'help' to     ncl-talk-request_at_ucar.edu You can reach the person managing the list at     ncl-talk-owner_at_ucar.edu When replying, please edit your Subject line so it is more specific than "Re: Contents of ncl-talk digest..." Today's Topics:   1. Re: How to define the rec_type in the function of    fbinrecread       to read a special binary file (Guangshan Chen)   2. Re: How to define the rec_type in the function of fbinrecread       to read a special binary file (shea_at_ucar.edu)   3. Re: How to define the rec_type in the function of    fbinrecread       to read a special binary file (Guangshan Chen)   4. regridding of ECMWF to WRF grid (BasitAli Khan)   5. Re: regridding of ECMWF to WRF grid (BasitAli Khan)   6. Re: regridding of ECMWF to WRF grid (shea_at_ucar.edu) ---------------------------------------------------------------------- Message: 1 Date: Sat, 26 Jan 2013 19:19:22 -0600 From: Guangshan Chen <gchen9_at_gmail.com> Subject: Re: How to define the rec_type in the function of     fbinrecread to read a special binary file To: Dennis Shea <shea_at_ucar.edu> Cc: "ncl-talk_at_ucar.edu NCL" <ncl-talk_at_ucar.edu> Message-ID: <EB1B55CD-DCAD-4D64-964E-B7A743E45D54_at_gmail.com> Content-Type: text/plain; charset=iso-8859-1 Dear Dennis and Dave, Thanks for the suggestion. It does not work. Hopeful NCL can read read multiple types at a time one day! Guangshan On Jan 25, 2013, at 2:31 PM, Dennis Shea <shea_at_ucar.edu> wrote: > NCL's fbin*read functions can only read one type at a time/ > >  fili = "example01" >  ii  = fbinrecread(fili, 0, 3, "integer") >  rr  = fbinrecread(fili, 0, 3, "float"  ) > >  a = ii(0) >  b = rr(1) >  c = rr(2) > > Good luck > > On 01/25/2013 09:17 AM, Guangshan Chen wrote: >> Dear all, >> >> I have a binary file. It is written as the following in the fortran code: >> >> integer a >> real b,c >> >> a=10 >> b=20.0 >> c=30.0 >> >> open(11, file="example01", form="unformatted") >> write(11) a, b, c >> >> >> There is only record in this binary file. If I would like to use fbinrecread to read >> finrecread("example01", 0, 3, ????). How to define the rec_type? >> >> a is integer, b and c are real. >> >> Thanks for any help. >> >> Guangshan >> >> _______________________________________________ >> ncl-talk mailing list >> List instructions, subscriber options, unsubscribe: >> http://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > ------------------------------ Message: 2 Date: Sat, 26 Jan 2013 19:38:13 -0700 From: shea_at_ucar.edu Subject: Re: How to define the rec_type in the function of     fbinrecread to read a special binary file To: "Guangshan Chen" <gchen9_at_gmail.com> Cc: "ncl-talk_at_ucar.edu NCL" <ncl-talk_at_ucar.edu> Message-ID:     <7a1ed3f797131e150d70b790c8c4bd1f.squirrel_at_webmail.cgd.ucar.edu> Content-Type: text/plain;charset=iso-8859-1 The outlined approch has worked on multiple machines and operating systems. Perhaps the fortran sequential file was created on a 'big-endian' machine and you are reading on a little-endian machine or vice versa. There is no automatic way to test. It is the user's responsibility to use thr sppropriate 'setfileoption' . > Dear Dennis and Dave, > > Thanks for the suggestion. > > It does not work. > > Hopeful NCL can read read multiple types at a time one day! > > Guangshan > > On Jan 25, 2013, at 2:31 PM, Dennis Shea <shea_at_ucar.edu> wrote: > >> NCL's fbin*read functions can only read one type at a time/ >> >>  fili = "example01" >>  ii  = fbinrecread(fili, 0, 3, "integer") >>  rr  = fbinrecread(fili, 0, 3, "float"  ) >> >>  a = ii(0) >>  b = rr(1) >>  c = rr(2) >> >> Good luck >> >> On 01/25/2013 09:17 AM, Guangshan Chen wrote: >>> Dear all, >>> >>> I have a binary file. It is written as the following in the fortran >>> code: >>> >>> integer a >>> real b,c >>> >>> a=10 >>> b=20.0 >>> c=30.0 >>> >>> open(11, file="example01", form="unformatted") >>> write(11) a, b, c >>> >>> >>> There is only record in this binary file. If I would like to use >>> fbinrecread to read >>> finrecread("example01", 0, 3, ????). How to define the rec_type? >>> >>> a is integer, b and c are real. >>> >>> Thanks for any help. >>> >>> Guangshan >>> >>> _______________________________________________ >>> ncl-talk mailing list >>> List instructions, subscriber options, unsubscribe: >>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk >>> >> > > ------------------------------ Message: 3 Date: Sat, 26 Jan 2013 20:41:21 -0600 From: Guangshan Chen <gchen9_at_gmail.com> Subject: Re: How to define the rec_type in the function of     fbinrecread to read a special binary file To: shea_at_ucar.edu Cc: "ncl-talk_at_ucar.edu NCL" <ncl-talk_at_ucar.edu> Message-ID: <42A91B9A-015E-4323-8044-32133DEC2CE1_at_gmail.com> Content-Type: text/plain; charset=iso-8859-1 Dear Dennis, Thanks. It was created on a "big-endian" machine. I have set the setfileoption to read big-endian. Guangshan On Jan 26, 2013, at 8:38 PM, shea_at_ucar.edu wrote: > The outlined approch has worked on multiple machines and operating systems. > > Perhaps the fortran sequential file was created on a 'big-endian' machine > and you are reading on a little-endian machine or vice versa. > > There is no automatic way to test. It is the user's responsibility to use > thr sppropriate 'setfileoption' . > >> Dear Dennis and Dave, >> >> Thanks for the suggestion. >> >> It does not work. >> >> Hopeful NCL can read read multiple types at a time one day! >> >> Guangshan >> >> On Jan 25, 2013, at 2:31 PM, Dennis Shea <shea_at_ucar.edu> wrote: >> >>> NCL's fbin*read functions can only read one type at a time/ >>> >>> fili = "example01" >>> ii  = fbinrecread(fili, 0, 3, "integer") >>> rr  = fbinrecread(fili, 0, 3, "float"  ) >>> >>> a = ii(0) >>> b = rr(1) >>> c = rr(2) >>> >>> Good luck >>> >>> On 01/25/2013 09:17 AM, Guangshan Chen wrote: >>>> Dear all, >>>> >>>> I have a binary file. It is written as the following in the fortran >>>> code: >>>> >>>> integer a >>>> real b,c >>>> >>>> a=10 >>>> b=20.0 >>>> c=30.0 >>>> >>>> open(11, file="example01", form="unformatted") >>>> write(11) a, b, c >>>> >>>> >>>> There is only record in this binary file. If I would like to use >>>> fbinrecread to read >>>> finrecread("example01", 0, 3, ????). How to define the rec_type? >>>> >>>> a is integer, b and c are real. >>>> >>>> Thanks for any help. >>>> >>>> Guangshan >>>> >>>> _______________________________________________ >>>> ncl-talk mailing list >>>> List instructions, subscriber options, unsubscribe: >>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>> >>> >> >> > > ------------------------------ Message: 4 Date: Sun, 27 Jan 2013 09:25:08 +0000 From: BasitAli Khan <BasitAli.Khan_at_kaust.edu.sa> Subject: regridding of ECMWF to WRF grid To: "ncl-talk_at_ucar.edu" <ncl-talk_at_ucar.edu> Message-ID:     <5B0AEC9F228B0E4093880B97E72BBDCE9D1710_at_WTHEMXND03.KAUST.EDU.SA> Content-Type: text/plain; charset="us-ascii" Hello, I want to regrid Era Interim Reanalysis  data (0.75 x 0.75 deg)  to my high resolution WRF gird (3 km). Just wondering which regridding/interpolation function is best to use for this purpose. I know there are heaps of functions and regridding scripts available but could not find anything that suits my requirement. WRF has a curvilinear grid while Era-Interim Re-analysis (if i am not wrong) uses Gaussian grid. I would greatly appreciate if anyone have the script and would like to share it. Thanks in advance Best regards, basit ________________________________ This message and its contents including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20130127/5f4bdea3/attachment.html ------------------------------ Message: 5 Date: Sun, 27 Jan 2013 11:23:25 +0000 From: BasitAli Khan <BasitAli.Khan_at_kaust.edu.sa> Subject: Re: [ncl-talk] regridding of ECMWF to WRF grid To: "bjfisel_at_gmail.com" <bjfisel_at_gmail.com>, "ncl-talk_at_ucar.edu"     <ncl-talk_at_ucar.edu> Message-ID:     <5B0AEC9F228B0E4093880B97E72BBDCE9D1724_at_WTHEMXND03.KAUST.EDU.SA> Content-Type: text/plain; charset="windows-1252" Hi, That's right, its generally an easy fix, however, unfortunately WPS does not interpolate all the Era-Interim variables to WRF grid e.g T2, U10 and V10. To output these vars i probably would need to make changes in V-table and/or at some other places and may also need to recompile WPS.  I am not sure if i can take values of the first level of TT, UU and VV from met_em_d0* with any degree of confidence but i would appreciate if you could share your experience on this. Cheers, ---- Basit A. Khan, Ph.D. Postdoctoral Research Fellow Division of Physical Sciences & Engineering Office# 3204, Level 3, Building 1, King Abdullah University of Science & Technology 4700 King Abdullah Blvd, Box 2753, Thuwal 23955 ?6900, Kingdom of Saudi Arabia. Office: +966(0)2 808 0276,  Mobile: +966(0)5 0860 3617 E-mail: basitali.khan_at_kaust.edu.sa<mailto:basitali.khan_at_kaust.edu.sa> Skype name: basit.a.khan From: "bjfisel_at_gmail.com<mailto:bjfisel_at_gmail.com>" <bjfisel_at_gmail.com<mailto:bjfisel_at_gmail.com>> Date: Sun, 27 Jan 2013 05:09:10 -0600 To: KAUST <basitali.khan_at_kaust.edu.sa<mailto:basitali.khan_at_kaust.edu.sa>> Subject: Re: regridding of ECMWF to WRF grid Hi, You should ingest the ECMWF data into the WRF Preprocessing System (WPS), which will put the data on the WRF 3-km grid. There is no need to regrid. On Jan 27, 2013, at 3:25, BasitAli Khan <BasitAli.Khan_at_kaust.edu.sa<mailto:BasitAli.Khan_at_kaust.edu.sa>> wrote: Hello, I want to regrid Era Interim Reanalysis  data (0.75 x 0.75 deg)  to my high resolution WRF gird (3 km). Just wondering which regridding/interpolation function is best to use for this purpose. I know there are heaps of functions and regridding scripts available but could not find anything that suits my requirement. WRF has a curvilinear grid while Era-Interim Re-analysis (if i am not wrong) uses Gaussian grid. I would greatly appreciate if anyone have the script and would like to share it. Thanks in advance Best regards, basit ________________________________ This message and its contents including attachments are intended solely for the original recipient. If you are not the intended recipient or have received this message in error, please notify me immediately and delete this message from your computer system. Any unauthorized use or distribution is prohibited. Please consider the environment before printing this email. _______________________________________________ ncl-talk mailing list List instructions, subscriber options, unsubscribe: http://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20130127/fed20ba9/attachment.html ------------------------------ Message: 6 Date: Sun, 27 Jan 2013 08:28:00 -0700 From: shea_at_ucar.edu Subject: Re: [ncl-talk] regridding of ECMWF to WRF grid To: "BasitAli Khan" <BasitAli.Khan_at_kaust.edu.sa> Cc: "ncl-talk_at_ucar.edu" <ncl-talk_at_ucar.edu> Message-ID:     <f83aabad438e5ab23a9bb29a3d4a54ea.squirrel_at_webmail.cgd.ucar.edu> Content-Type: text/plain;charset=iso-8859-1 rectilinear [ECMWF] to curvilinear [WRF]: You could use ESMF regrid example 9 and (say) example 20 as a start. Generating the weight file may take some time but, once the weight file is generated, the actual regridding is quite fast. > Hi, > That's right, its generally an easy fix, however, unfortunately WPS does > not interpolate all the Era-Interim variables to WRF grid e.g T2, U10 and > V10. To output these vars i probably would need to make changes in V-table > and/or at some other places and may also need to recompile WPS.  I am not > sure if i can take values of the first level of TT, UU and VV from > met_em_d0* with any degree of confidence but i would appreciate if you > could share your experience on this. > > Cheers, > ---- > Basit A. Khan, Ph.D. > Postdoctoral Research Fellow > Division of Physical Sciences & Engineering > Office# 3204, Level 3, Building 1, > King Abdullah University of Science & Technology > 4700 King Abdullah Blvd, Box 2753, Thuwal 23955 ?6900, > Kingdom of Saudi Arabia. > > Office: +966(0)2 808 0276,  Mobile: +966(0)5 0860 3617 > E-mail: basitali.khan_at_kaust.edu.sa<mailto:basitali.khan_at_kaust.edu.sa> > Skype name: basit.a.khan > > From: "bjfisel_at_gmail.com<mailto:bjfisel_at_gmail.com>" > <bjfisel_at_gmail.com<mailto:bjfisel_at_gmail.com>> > Date: Sun, 27 Jan 2013 05:09:10 -0600 > To: KAUST <basitali.khan_at_kaust.edu.sa<mailto:basitali.khan_at_kaust.edu.sa>> > Subject: Re: regridding of ECMWF to WRF grid > > Hi, > > You should ingest the ECMWF data into the WRF Preprocessing System (WPS), > which will put the data on the WRF 3-km grid. There is no need to regrid. > > > On Jan 27, 2013, at 3:25, BasitAli Khan > <BasitAli.Khan_at_kaust.edu.sa<mailto:BasitAli.Khan_at_kaust.edu.sa>> wrote: > > Hello, > > I want to regrid Era Interim Reanalysis  data (0.75 x 0.75 deg)  to my > high resolution WRF gird (3 km). Just wondering which > regridding/interpolation function is best to use for this purpose. I know > there are heaps of functions and regridding scripts available but could > not find anything that suits my requirement. WRF has a curvilinear grid > while Era-Interim Re-analysis (if i am not wrong) uses Gaussian grid. I > would greatly appreciate if anyone have the script and would like to share > it. > > Thanks in advance > Best regards, > basit > > ________________________________ > > This message and its contents including attachments are intended solely > for the original recipient. If you are not the intended recipient or have > received this message in error, please notify me immediately and delete > this message from your computer system. Any unauthorized use or > distribution is prohibited. Please consider the environment before > printing this email. > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk > _______________________________________________ > ncl-talk mailing list > List instructions, subscriber options, unsubscribe: > http://mailman.ucar.edu/mailman/listinfo/ncl-talk > ------------------------------ _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk End of ncl-talk Digest, Vol 110, Issue 33 *****************************************

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Jan 27 12:39:52 2013

This archive was generated by hypermail 2.1.8 : Tue Jan 29 2013 - 22:44:26 MST