[ncl-talk] coordinate subscripting in curvilinear data

Adam Phillips asphilli at ucar.edu
Mon Oct 29 12:40:33 MDT 2018


Hi Jyothi,
Try using getind_latlon2d to return the nearest 2D coordinate indices to a
lat/lon pair:
http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml

If you have further questions let the ncl-talk email list know.
Adam

On Mon, Oct 29, 2018 at 12:34 PM Jyothi Lingala <jyothirao.lingala at gmail.com>
wrote:

> Hii..
>
> I am trying to plot a time series at specific location from model output.
> Attached is my model file. I suppose my input data is on a curvilinear
> grid, where I cannot use "{" and "}" for coordinate subscripting. The
> following script works when I specify the lat and lon indices manually.
> Instead of doing this, I would like to specify the lat and lon values
> directly(eg, 9N 67E). Kindly correct me where I am going wrong.
>
> *SCRIPT*
> load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/time_axis_labels.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>
> dir    =
> "/incois_ncmrwfx/incois/hycom/hwrf_output/pytmp/HYCOMcoupled_gsi/2017120100/03B/runwrf/"
> files  = systemfunc("ls " + dir + "wrfout_d01_2017-12-*_*_00_00") ; one of
> the files is attached
> a      = addfiles(files,"r")
>  wrfout_d01_2017-12-01_00_00_00
> <https://drive.google.com/file/d/1CO8FnR_N82jlcOSeb2OlKImJAqXRjT40/view?usp=drive_web>
>
> ListSetType(a,"cat")
> vNames = getfilevarnames(a[0])
> ;print(vNames)
>
> ;----- Read character variable Times -  Convert to units of "hours since"
> for plotting purposes
>
>   times     = a[:]->Times
>   Time      = wrf_times_c(a[:]->Times, 0)  ; convert to "hours since"
> ;  print(Time)
>
>  sst                = a[:]->SST
>  sst                = sst-273.15
>  lat                 = a[:]->HLAT
>  lon                = a[:]->HLON
>  sst at lon2d        = lon
>  sst at lat2d        = lat
>
> utc_date =  cd_calendar(Time, 0)
> year        =  tointeger(utc_date(:,0))
> month     =  tointeger(utc_date(:,1))
> day         =  tointeger(utc_date(:,2))
> date_str   =  sprinti("%0.4i-",year)+sprinti("%0.2i-", month) + \
>             sprinti("%0.2i", day);+sprinti("%0.2i", hour)
>
> wks = gsn_open_wks("png","timeseries_WRF")
>
> res                          = True
> res at gsnMaximize              = True
> res at vpWidthF                 = 0.65
> res at vpHeightF                = 0.3
> restick                      = True
> restick at ttmFormat            = "%D/%c"
> time_axis_labels(Time,res,restick)
>
> plot = gsn_csm_xy(wks,Time,sst(:,291,151),res);;;;:::::::::::This line is
> working. Here I want to specify the lat and lon values directly(eg. 9N 67E).
>
> Thanks and regards
> Jyothi
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


-- 
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181029/78ecc5ab/attachment.html>


More information about the ncl-talk mailing list