# Re: Map with Divergence

From: Prof. Mônica Senna <monicasenna_at_nyahnyahspammersnyahnyah>
Date: Tue May 28 2013 - 12:51:18 MDT

Hi Dennis,

Thanks a lot for your help! Now the map is correct and beautiful!

Best Regards,

2013/5/28 Dennis Shea <shea@ucar.edu>

> Since you have a global gaussian grid, use
>
> div = uv2dvG_Wrap(u,v)
> printVarSummary(div)
>
> http://www.ncl.ucar.edu/**Document/Functions/**
> Contributed/uv2dvG_Wrap.shtml<http://www.ncl.ucar.edu/Document/Functions/Contributed/uv2dvG_Wrap.shtml>
>
> ---
> To get a nice symmetric contour range for the divergence, use
>
> http://www.ncl.ucar.edu/**Document/Functions/**
> Contributed/symMinMaxPlt.shtml<http://www.ncl.ucar.edu/Document/Functions/Contributed/symMinMaxPlt.shtml>
>
> symMinMaxPlt (div,20,False,res) ; all levels
>
> or
>
> symMinMaxPlt (div(nt,{250},:,:),20,False,**res)
>
> for a specific time (nt=0 means the 1st time)
>
> ---
> Please note: there is a Portuguese manual at
>
> http://www.ncl.ucar.edu/**Document/Manuals/<http://www.ncl.ucar.edu/Document/Manuals/>
>
> Also, a tutorial by Guilherme Martins which has not
> yet been added to the NCL WWW yet. I wll send offline.
>
>
> Regards
>
>
>
>
> On 5/27/13 2:01 PM, Prof. Mônica Senna wrote:
>
>> Hi Dennis,
>>
>> My data is on global grid at a spectral resolution of T42 (~2.81 X 2.81
>> latitude–longitude grid), from CCM3. I want to make a figure like this
>> below (streamlines with divergence):
>>
>> [image: Imagem inline 1]
>>
>>
>> I will start with the script below (that plots streamlines with omega, I
>> will change omega for divergence...), and I think I should use this
>> operator uv2dvG, but what will I plot? dv or uvd (
>> http://www.ncl.ucar.edu/**Document/Functions/Built-in/**uv2dvG.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2dvG.shtml>)?
>> I did
>> not understand the difference between these two...
>>
>> Thanks a lot!!
>>
>> Mônica
>>
>> --------------------------
>> ;=============================**===================;
>> ; stream_10.ncl
>> ;=============================**===================;
>>
>> ; ==============================**==================;
>> begin
>> ;=============================**====================;
>> ; open file and read in data
>> ;=============================**====================;
>> u = f1->U(0,10,:,:) ; read in example data [2D only here]
>> v = f2->V(0,10,:,:)
>> o = f3->OMEGA(0,10,:,:)
>>
>>
>> ;=============================**====================;
>> ; Create plot
>>
>> ;=============================**====================;
>> ; this data only has an missing_value, so we are
>> ; copying this to _FillValue for plotting purposes
>> ;
>> ;assignFillValue(v,u)
>> ;assignFillValue(u,v)
>>
>> ;---create plot
>> wks = gsn_open_wks("pdf" ,"stream5") ; open a ps file
>> gsn_define_colormap(wks,"gui_**default") ; choose colormap
>>
>> res = True ; plot mods desired
>> res@mpFillOn = False
>>
>> res@cnFillOn = True ; color fill
>> ;res@cnLevelSpacingF = 3. ; interval spacing
>> res@cnLinesOn = False ; no contour lines
>>
>> res@stLineColor = "white"
>> res@stLineThicknessF = 2
>>
>> res@gsnSpreadColors = True ; use full colormap
>>
>> res@stArrowLengthF = 0.008 ; default is dynamic
>> res@stLengthCheckCount = 5 ; default is 35
>> res@stArrowStride = 1
>> res@stLineStartStride = 1 ; default is 2
>> res@stMinArrowSpacingF = 0.03 ; default is 0.0
>>
>> res@stStepSizeF = 0.001 ; default is dynamic
>>
>> res@stMinDistanceF = 0.02 ; distance between lines
>> res@stMinLineSpacingF = 0.009
>>
>> ; because this is ice data, which has a gap in the tropics, we need to
>> ; explicitly pass the range of the data to plot. Since we are coloring
>> ; the vectors, this range should also match the MinLatF above, since the
>> ; range for the colors is chosen over the full data passed, and not the
>> ; map limits.
>>
>> res@mpDataSetName = "Earth..4" ; This new database contains
>> ; divisions for other
>> res@mpDataBaseVersion = "MediumRes" ; Medium resolution database.
>> res@mpOutlineBoundarySets = "allBoundaries"
>> res@mpOutlineOn = True ; Turn on map outlines
>> res@mpOutlineSpecifiers =(/"Brazil:states"/)
>> ;res@mpOutBoundarySets = "National"
>>
>> res@mpFillOn = False ; Turn on map fill
>> res@mpFillBoundarySets = "National"
>> res@mpFillAreaSpecifiers = (/"Brazil:states"/) ; divisao dos paises
>>
>> ;res@cnFillMode = "RasterFill" ; nao interpolar..
>>
>> res@mpGridLineDashPattern = 2 ; lat/lon lines as
>> dashed
>> res@pmTickMarkDisplayMode = "Always" ; turn on tickmarks
>>
>> ;res@tiMainString = "Teste"
>> ;res@tiMainFontHeightF = 0.020 ; smaller title
>>
>> ;res@mpMaxLatF = 15 ; South America limits
>>
>>
>> res@gsnAddCyclic = False ; regional data (Deve
>> res@mpDataBaseVersion = "MediumRes"
>>
>> ;res@cnLevelSelectionMode = "ExplicitLevels"
>> ;res@cnLevels = (/2.,4.,6.,8.,10.,12./)
>>
>> res@lbOrientation = "Vertical"
>> res@pmLabelBarOrthogonalPosF = -0.01 ; move label bar closer
>> ;res@lbLabelStride = 4
>>
>>
>> res@mpMaxLatF = 15
>> res@mpMinLatF = -60
>> res@mpMaxLonF = -33
>> res@mpMinLonF = -82
>>
>>
>> plot = gsn_csm_streamline_contour_**map(wks,u,v,o,res)
>>
>> end
>> ------------------------------**------------
>>
>>
>>
>>
>> 2013/5/23 Dennis Shea <shea@ucar.edu>
>>
>> You did not say what your data looked like!
>>>
>>> printVarSummary(u)
>>>
>>> If your data is on a *global* grid, the you can use spherical
>>> harmonic operators:
>>>
>>> http://www.ncl.ucar.edu/****Document/Functions/Built-in/****
>>> uv2dvF.shtml<http://www.ncl.ucar.edu/**Document/Functions/Built-in/**uv2dvF.shtml>
>>> <http://www.ncl.**ucar.edu/Document/Functions/**Built-in/uv2dvF.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2dvF.shtml>
>>> >
>>> or
>>> http://www.ncl.ucar.edu/****Document/Functions/Built-in/****
>>> uv2dvG.shtml<http://www.ncl.ucar.edu/**Document/Functions/Built-in/**uv2dvG.shtml>
>>> <http://www.ncl.**ucar.edu/Document/Functions/**Built-in/uv2dvG.shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2dvG.shtml>
>>> >
>>>
>>>
>>>
>>> -------
>>>
>>> Otherwise, for rectilinear grids:
>>>
>>> http://www.ncl.ucar.edu/****Document/Functions/Built-in/****
>>> uv2dv_cfd.shtml<http://www.ncl.ucar.edu/**Document/Functions/Built-in/**uv2dv_cfd.shtml>
>>> <http://www.**ncl.ucar.edu/Document/**Functions/Built-in/uv2dv_cfd.**
>>> shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2dv_cfd.shtml>
>>> >
>>>
>>> http://www.ncl.ucar.edu/****Document/Functions/Built-in/****
>>> uv2dvr_cfd.shtml<http://www.ncl.ucar.edu/**Document/Functions/Built-in/**uv2dvr_cfd.shtml>
>>> <http://www.**ncl.ucar.edu/Document/**Functions/Built-in/uv2dvr_cfd.**
>>> shtml<http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2dvr_cfd.shtml>
>>> >
>>>
>>>
>>> Good luck
>>>
>>>
>>> On 5/23/13 9:37 AM, Prof. Mônica Senna wrote:
>>>
>>> Hi NCL users,
>>>>
>>>> I want to make a map of streamlines with divergence (the divergence must
>>>> be
>>>> only colors), but I don´t know how. I did one with streamlines and omega
>>>> (figure below), the appeareance is similar of the map of divergence I
>>>> want
>>>> to make. The script will be similar?
>>>>
>>>>
>>>> [image: Imagem inline 1]
>>>>
>>>>
>>>>
>>>> Thanks a lot for your attention!
>>>>
>>>>
>>>>
>>>> ______________________________****_________________
>>>>
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/****mailman/listinfo/ncl-talk<http://mailman.ucar.edu/**mailman/listinfo/ncl-talk>
>>>> <http**://mailman.ucar.edu/mailman/**listinfo/ncl-talk<http://mailman.ucar.edu/mailman/listinfo/ncl-talk>
>>>> >
>>>>
>>>>
>>>>
>>
>>

```--
Profª. Mônica Carneiro Alves Senna
Departamento de Análise Geoambiental
Instituto de Geociências