[ncl-talk] plot with irregular latitude

clotilde dubois clotilde.dubois at mercator-ocean.fr
Fri Nov 13 10:31:52 MST 2015


Dear ncl-users,

I am trying to plot an ocean section (lat/depth) at a constant
longitude.  The grid is irregular and when plotting , i cannont managed
to get the latitude coordinates right. Evenif i try the command:
v_subregion&lat = lat2d(latS:latN,lonW) or similar.

Best regards,

Clotilde


PS: here, it is the script
;
;
;
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
  filename =
"/sortref/opr/pgn1/PSY3/psy3v3r3/PSY3V3R3_1dAV_20150105_20150106_gridT_R20150114.nc"
  f        = addfile (filename, "r")
  v        = short2flt(f->votemper )        ; (time_counter, deptht, y, x)


  lat2d    = f->nav_lat             ; (y,x)
  lon2d    = f->nav_lon             ; (y,x)
  nt       = 0                      ; time index to plot
  nd       = 0                      ; depth index to plot

;  v = where(v.ge.v at _FillValue,v at _FillValue,v)


;---Start the graphics
  wks = gsn_open_wks("eps" ,"figure_test")

;---Set some resources
  res                 = True
  res at gsnMaximize         = True

  res at gsnSpreadColors     = True
  res at cnFillOn        = True          ; Turn on contour fill
  res at cnLinesOn       = True         ; Turn off contour lines
  res at cnLineLabelsOn  = True         ; Turn off line labels
  res at lbLabelAutoStride = True
  res at trYReverse               = True    ; Reverse Y axis
  res at tmXBTickSpacingF = 5
  res at cnLabelBarEndStyle = "ExcludeOuterBoxes"


;---Area to do the cross-section across
 latS = 0
  latN = 1020
  lonW = 600
  nivsup = 0 ; a partir de 100 m
  nivinf= 40

;---Get a subregion to plot
v_subregion = v(nt,nivsup:nivinf,latS:latN,lonW)

printVarSummary(v_subregion)


;---The new coordinate array is double, so convert to float
newdep0 = tofloat((/f->deptht/))


;v_subregion&deptht = newdep0(nivsup:nivinf)
;v_subregion&nav_lat = lat2d(latS:latN,lonW)

;res at sfXArray     = v_subsection&y
;res at sfYArray             = v_subsection&deptht      ; y axis array

 res at gsnYAxisIrregular2Linear = True ; converts irreg depth to linear
 res at trYReverse=True                 ; reverses y-axis


plot = gsn_csm_contour(wks,v_subregion,res)


  frame(wks)

end


On 09/02/15 16:51, clotilde dubois wrote:
> Dear ncl-users,
>
>
> I am trying to use the function lonFlip, but i keep having the following
> message (see below). Whereas I have no problem to use the lonFlip
> function. Do you have any idea why it is not working?
>
> Best regards,
>
> Clotilde Dubois
>



More information about the ncl-talk mailing list