[ncl-talk] Wrf output at multiple mast locations
Muhammad Omer Mughal
m.mughal1 at postgrad.curtin.edu.au
Mon Jul 17 18:55:04 MDT 2017
Hi Mary
Many thanks for your reply. Kindly see the code I use now to get 2m temperature at one location. The problem is that I am unable to get the corresponding times in the ascii file. Also is there a way to use 15 locations in line
loc = wrf_user_ll_to_ij(a, 103.78538333,1.44386667, True) instead of just one.
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"
;***********************************************
begin
;***********************************************
DATADir = "./"
FILES = systemfunc (" ls -1 " + DATADir + "wrfout_d05* ")
a = addfiles(FILES+".nc","r")
times = wrf_user_list_times(a)
ntimes = dimsizes(times)
do it = 0,ntimes-1
ntimes = dimsizes(times)
T2= new(ntimes,"string")
time = it
loc = wrf_user_ll_to_ij(a, 103.78538333,1.44386667, True)
mx = loc(0) - 1 ; array pointers in NCL space
ny = loc(1)-1
lat1 = a[0]->XLAT(0,ny,mx) ; the is the nearest grid point
lon1 = a[0]->XLONG(0,ny,mx)
tc2 = wrf_user_getvar(a,"T2",it) ; T2 in Kelvin
tc2 = tc2-273.16 ; T2 in C
end do
asciiwrite("2mtemperature.csv",tc2)
end
Muhammad Omer Mughal
MSc BSc Mechanical Engineering
PhD Research Scholar
Remote Sensing and Satellite Research Group
Department of Imaging and Applied Physics
Curtin University
Curtin University
Tel | +61 8 9266 7962
Fax | +61 8 9266 2377
Mobile | 0470 237 525
Email | m.mughal1 at postgrad.curtin.edu.au<mailto:m.lynch at curtin.edu.au>
Web | http://curtin.edu.au<http://curtin.edu.au/>
Curtin University is a trademark of Curtin University of Technology.
CRICOS Provider Code 00301J (WA), 02637B (NSW)
________________________________
From: Mary Haley <haley at ucar.edu>
Sent: Friday, 14 July 2017 10:44:04 PM
To: Muhammad Omer Mughal
Subject: Re: [ncl-talk] Wrf output at multiple mast locations
Muhammad,
For plotting WRF data, I recommend visiting this page:
http://www.ncl.ucar.edu/Applications/wrf.shtml
As that first box points, out, you can use wrf_user_getvar:
http://www.ncl.ucar.edu/Document/Functions/WRF_arw/wrf_user_getvar.shtml
to calculate various diagnostics and/or read variables. It has some examples, including how to read 2m temperature (in degK):
t2 = wrf_user_getvar(f,"T2",-1) ; read 2m temp across all time steps
In order to compare observational data with data that's on a WRF grid, you need to regrid or place the obs data on the WRF grid.
To regrid the data using ESMF, this involves interpolation, which you may or may not want.
See example ESMF_regrid_20.ncl at:
http://www.ncl.ucar.edu/Applications/ESMF.shtml#ex20
This goes from a WRF grid to another WRF grid, but the main change you need to make is to the "lat_src" and "lon_src" variables, which represent your source grid. These will need to be set the observational lat/lon 1D arrays in your case.
If you don't want to interpolate the data, then you can try triple2grid2d, which we don't have any examples for, but the documentation has some code snippets for:
http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid2d.shtml
Finally, you may also want to visit the "gridding random data" page:
http://www.ncl.ucar.edu/Document/Functions/Built-in/triple2grid2d.shtml
I'm not sure this is your best set of examples, but I think it's worth looking at all these different methods to see which one best fits your purpose.
If you have problems with this and are able to provide us with your script and data, then we can help you out and maybe create a new example for our examples page so other users can benefit.
Good luck,
--Mary
On Wed, Jul 12, 2017 at 6:50 PM, Muhammad Omer Mughal <m.mughal1 at postgrad.curtin.edu.au<mailto:m.mughal1 at postgrad.curtin.edu.au>> wrote:
Hi
Is it possible in NCL to grab 2m temperature time series data at multiple locations in a single Wrf output file . I have about 15 stations and I want to compare the temperature at those locations with Wrf simulated temperature at 2m. Is there any example script that I can look at ?
Also I would like to compare 2m temperature at single time from Wrf and observations and plot the difference.please direct me to the relevant example.
Thanks
Muhammad Omer Mughal
MSc BSc Mechanical Engineering
PhD Research Scholar
Remote Sensing and Satellite Research Group
Department of Imaging and Applied Physics
Curtin University
Curtin University
Tel | +61 8 9266 7962<tel:+61%208%209266%207962>
Fax | +61 8 9266 2377<tel:+61%208%209266%202377>
Mobile | 0470 237 525
Email | m.mughal1 at postgrad.curtin.edu.au<mailto:m.mughal1 at postgrad.curtin.edu.au>
Web | http://curtin.edu.au
Curtin University is a trademark of Curtin University of Technology.
CRICOS Provider Code 00301J (WA), 02637B (NSW)
_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
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/20170718/47c9f8e6/attachment.html
More information about the ncl-talk
mailing list