Re: RTOFS global grid shift

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Mon Aug 26 2013 - 18:26:42 MDT

Hi Yu,
It is true that NCL can handle 2-D lat/lon coordinates, but it is not as automatic as it would be with 1D coordinate variables.
You need to 1) read the coordinate values to local variables 2) attach the values to special attributes and 3) remember to subset the coordinate variables the same as your data variable.

1):
lat = prog->Latitude
lon = prog->Longiude

2) and 3)
  rtofs_sst@lon2d = lon(::5,::5)
  rtofs_sst@lat2d = lat(::5,::5)

plot = gsn_csm_contour_map(wks,rtofs_sst(::5,::5),res)

This is a quick and dirty solution. It would probably be better to have the data variable pre-subsetted to the same number of elements as the coordinates, i.e.:

sst = rtofs_sst(::5,::5)
sst@lon2d = lon(::5,::5)
sst@lat2d = lat(::5,::5)

plot = gsn_csm_contour_map(wks,sst,res)

Hope this helps,
 -dave

On Aug 26, 2013, at 4:22 PM, Yu <fischcheng@gmail.com> wrote:

> Hi everyone,
>
> I'm attempting to use RTOFS daily output to plot out some SSH and SST data. As I knew, RTOFS data is produced by HYCOM, which has a two-dimensional longitude-latitude coordinate. With sst(MT,Y,X) Latitude(X,Y) and Longitude(X,Y) However, no matter how hard I tried, using gsn_csm_contour_map to plot out the SST contour, the Map just doesn't fit to the data. It probably due to the Longitude dimension of the data. By the way, is that normal, as I execute my script, some warning like these just show on my screen:
>
> (0) check_for_y_lat_coord: Warning: Data either does not contain a valid latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units' attribute equal to one of the following values:
> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain a valid longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units' attribute equal to one of the following values:
> (0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east' 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
> (0) gsn_csm_map_ce: Warning: you set mpMaxLonF to a value > 180, but
> (0) didn't set mpCenterLonF. Setting mpCenterLonF to 210
>
> From my experience, I thought NCL can naturally handle the two-dimensional Lat-Lon without any issues. It did generated plots, but I couldn't find a way to get rid off these warnings. One more thing, is the grid RTOFS output different from normal HYCOM output? I already looked up the HYCOM page on NCL site, just didn't know the solution. Anyone worked on RTOFS data before? Thank you!
>
> Yu Cheng
>
> p.s. code see attached
>
> ;*************************************************
> ; meteor_daily.ncl
> ;************************************************
> 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/csm/contributed.ncl"
> ;************************************************
> begin
> ;************************************************
> ; read in netCDF file
> ;************************************************
> diri="/Users/yucheng/Desktop/cruise/"
> ; f1="nc_20130824-REMSS-L4HRfnd-GLOB-v01-fv03-mw_ir_rt_OI.nc.gz.nc"
> ; f2="rtofs_glo_2ds_f024_daily_diag.nc"
> f3="rtofs_glo_2ds_f024_daily_prog.nc"
>
> ; ghr = addfile(diri+f1,"r")
> ; diag = addfile(diri+f2,"r")
> prog = addfile(diri+f3,"r")
> ;************************************************
> ; read in GHRSST and RTOFS
> ;************************************************
> ; rtofs_ssh=diag->ssh(0,:,:)
> rtofs_sst=prog->sst(0,:,:)
> ; rtofs_u=prog->u_velocity(0,0,:,:)
> ; rtofs_v=prog->v_velocity(0,0,:,:)
> ; ghrsst=ghrsst-273.15
> ; speed=sqrt(rtofs_u*rtofs_u+rtofs_v*rtofs_v)
>
>
> ;************************************************
> ; create each plot
> ;************************************************
> wks = gsn_open_wks("ps","meteor")
> gsn_define_colormap(wks,"rainbow")
>
> ;************************************************
> ; resources for the SST plots
> ;************************************************
> res = True
> ; res@gsnDraw = False ; do not draw picture
> ; res@gsnFrame = False ; do not advance frame
> res@cnLevelSelectionMode = "ManualLevels"
> res@cnMinLevelValF = 0.
> res@cnMaxLevelValF = 30.
> res@cnLevelSpacingF = 0.5
> res@gsnSpreadColors= True
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnFillOpacityF = 0.8
>
> res@mpMinLatF = -50
> res@mpMaxLatF = -0.
> res@mpMinLonF = 0.
> res@mpMaxLonF = 60.
>
> res@lbOrientation = "Vertical" ; vertical label bar
>
> res@tiMainString = "RTOFS SST Aug24"
> plot = gsn_csm_contour_map(wks,rtofs_sst(::5,::5),res)
>
> end
>
> Yu Cheng
> _______________________________________________
> 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
Received on Mon Aug 26 18:26:53 2013

This archive was generated by hypermail 2.1.8 : Fri Aug 30 2013 - 14:04:57 MDT