Re: map projections

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 17 Dec 2007 08:46:36 -0700

My previous message suggested that you

===
Remove:
tfDoNDCOverlay = True
===

Anyway ... I have appended a simple script to plot the data
                   on both cylindrical and Lambert Conformal projections

Good luck

jimmyc_at_iastate.edu wrote:
> All-
> I followed Dennis's advice but without luck.
> I got closer by specifying the additional arguements:
> mpLambertParallel1F = 30
> mpLambertParallel2F = 60
> mpLambertMeridianF = 260
>
> AND
> tfDoNDCOverlay = true
>
> but the data still doesnt match up with the map background. Now they
> both have the same orientation but there is an offset which has eluded
> me.
>
> Any ideas will be most welcome.
> jimmyc
>
>
>
> On Fri, 14 Dec 2007, Dennis Shea wrote:
>
>
>>
>> Remove:
>> tfDoNDCOverlay = True
>>
>> Also .... did you unpack the precip data?
>> It is of type short?
>>
>> prc = short2flt( f->precip )
>> printVarSummary(prc)
>>
>>
>>
>>
>> jimmyc_at_iastate.edu wrote:
>>> All-
>>> I am trying to plot the Unified precipitation dataset from CDC. It
>>> is a netcdf file but has no information on the map projection. The
>>> data is on a lat lon grid:
>>> netcdf precip.1993 {
>>> dimensions:
>>> lon = 321 ;
>>> lat = 161 ;
>>> time = UNLIMITED ; // (365 currently)
>>> variables:
>>> float lat(lat) ;
>>> lat:units = "degrees_north" ;
>>> lat:long_name = "Latitude" ;
>>> lat:actual_range = 20.f, 60.f ;
>>> float lon(lon) ;
>>> lon:units = "degrees_east" ;
>>> lon:long_name = "Longitude" ;
>>> lon:actual_range = 220.f, 300.f ;
>>> double time(time) ;
>>> time:units = "hours since 1700-1-1 00:00:0.0" ;
>>> time:long_name = "Time" ;
>>> time:actual_range = 2568384., 2577120. ;
>>> time:delta_t = "0000-00-01 00:00:00" ;
>>> time:avg_period = "0000-00-01 00:00:00" ;
>>> short precip(time, lat, lon) ;
>>> precip:long_name = "Daily Accumulated Precipitation" ;
>>>
>>>
>>> When I attempt to plot it using the
>>> mpProjection = "LambertConformal"
>>> mpLimitMode = "Corners"
>>> mpLeftCornerLatF = lat(0)
>>> mpLeftCornerLonF = lon(0)
>>> mpRightCornerLatF = lat(160)
>>> mpRightCornerLonF = lon(320)
>>>
>>> The image that is produced has the map background rotated 90 degrees
>>> but the displayed data is in the correct orientation.
>>>
>>> I do have this:
>>> tfDoNDCOverlay = True
>>>
>>> I have no idea if this is a Lambert grid but other projection types
>>> didnt seem to work either.
>>>
>>> Any ideas?
>>>
>>
>>
>>
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================

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
;*******************************************
; open file and read in data
;*******************************************
  f = addfile ("precip.1993.nc", "r")
  p = short2flt( f->precip )
  printVarSummary( p )
  printMinMax( p, True )
      
  time = f->time
  ymd = ut_calendar( time, -2)

  dimp = dimsizes(p)
  ntim = dimp(0)
  nlat = dimp(1)
  mlon = dimp(2)
;********************************************
; create plot
;********************************************
  wks = gsn_open_wks ("x11", "precip") ; open workstation
  gsn_define_colormap (wks,"BlAqGrYeOrReVi200") ; choose color map
  
  res = True ; plot mods desired
  res_at_cnFillOn = True ; color fill
  res_at_cnLinesOn = False ; no contour lines
  res_at_cnLineLabelsOn = False ; no contour labels
  res_at_cnInfoLabelOn = False ; no contour info label

 ;res_at_cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
 ;res_at_cnMinLevelValF = 0.0 ; set min contour level
 ;res_at_cnMaxLevelValF = 10. ; set max contour level
 ;res_at_cnLevelSpacingF = 0.25 ; set contour spacing

  res_at_cnLevelSelectionMode = "ExplicitLevels"
  res_at_cnLevels = (/0.001,0.05,0.1,0.2,0.3,0.4,0.5,0.75,1.0 \
                                ,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0 /)

  res_at_gsnMaximize = True
  res_at_gsnSpreadColors = True ; use total colormap
  res_at_gsnSpreadColorStart = 30
  res_at_gsnSpreadColorEnd = -1
  res_at_gsnAddCyclic = False ; regional data

  res_at_lbLabelAutoStride = True ; automatically choose best stride

  res_at_mpMinLatF = p&lat(0)
  res_at_mpMaxLatF = p&lat(nlat-1)
  res_at_mpMinLonF = p&lon(0)
  res_at_mpMaxLonF = p&lon(mlon-1)
  
  nt = 0 ; 1st time step
  res_at_tiMainString = "PRECIP: "+ymd(nt)
  
  PP = p(nt,:,:)
  PP = where(PP.eq.0.0, PP@_FillValue, PP)
  plot = gsn_csm_contour_map_ce(wks,PP,res)

  res_at_mpLimitMode = "LatLon"
  
  res_at_mpProjection = "LambertConformal"
  res_at_mpLambertParallel1F = 30.
  res_at_mpLambertParallel2F = 60.
  res_at_mpLambertMeridianF = 0.5*(p&lon(0)+p&lon(mlon-1))
  res_at_mpGridAndLimbOn = True
  res_at_mpGridLineDashPattern = 10
  
  plot = gsn_csm_contour_map(wks,PP,res)
end

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Dec 17 2007 - 08:46:36 MST

This archive was generated by hypermail 2.2.0 : Mon Dec 31 2007 - 09:18:01 MST