[ncl-talk] Ease grid map is misaligned
Mary Haley
haley at ucar.edu
Fri Jun 3 08:30:48 MDT 2016
Ipshita,
Thanks for providing the files, this was helpful!
The key to plotting this seems to be using raster mode:
res at cnFillMode = "RasterFill"
You also want to make sure you have both of these set:
res at trGridType = "TriangularMesh" ; allow missing coordinates
res at gsnAddCyclic = False ; don't wrap longitude point
A minor thing: you have this line, which doesn't have any purpose:
swe_FillValue=-9.99e+08
I think you meant to type:
swe at _FillValue=-9.99e+08
but this is not needed because "swe" already has the correct _FillValue
attribute attached.
Finally, this is not a problem, but there's a better way to set your colors
for the contours. Instead of calling "gsn_define_colormap" and setting
"res at gsnSpreadColors" to True, you can simply set "res at cnFillPalette" to
"amwg". The color map will be spanned automatically.
Please see the attached script.
--Mary
On Thu, Jun 2, 2016 at 4:40 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:
> Hi Mary,
>
> I transfered the files . They are named GlobSnow_SWE_L3A_20110101_v2.0.nc
> and monthly_82_13.nc.
>
> Thank you for your help.
> Best Regards
> Ipshita
>
> On Thu, Jun 2, 2016 at 1:49 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> The only thing I can think of at this point is perhaps there's an issue
>> with the longitude values crossing from 0 to 360 abruptly.
>>
>> Can you provide your data file on our ftp site?
>>
>> http://www.ncl.ucar.edu/report_bug.shtml#HowToFTP
>>
>> --Mary
>>
>>
>> On Thu, Jun 2, 2016 at 3:30 PM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:
>>
>>> Hi Mary,
>>>
>>> I noticed that my plot has straight lines that run through it. I removed
>>> part of those lines when I commented out res at trGridType =
>>> "TriangularMesh.
>>> But some of the lines still remain.
>>> How do I remove those lines?
>>> I am attaching my code and the picture of the map with this email.
>>>
>>> **************************************************************************
>>> ;*******************************************
>>> 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"
>>> ;*******************************************
>>>
>>> ;============================================
>>> ; set up parameters
>>> ;============================================
>>>
>>> ;********************************************
>>> ;This is reading in Snow water equivalent which goes from 0 to 250 mm
>>> ; from 1982 to 2012
>>> ;********************************************
>>>
>>> a=addfile("/Users/ipshita/Desktop/GlobsnowV2.0/version02/
>>> monthly_82_13.nc","r")
>>> b=addfile("/Users/ipshita/Desktop/GlobsnowV2.0/version02/2011/
>>> GlobSnow_SWE_L3A_20110101_v2.0.nc","r")
>>> swe=a->swe
>>>
>>> time=a->time
>>>
>>> lat=b->lat
>>> lon=b->lon
>>>
>>> swe at lat2d=lat
>>> swe at lon2d=lon
>>>
>>> printMinMax(lat,False)
>>> printMinMax(lon,False)
>>> swe_FillValue=-9.99e+08
>>>
>>> printVarSummary(swe)
>>>
>>> utc_date = cd_calendar(time, 0)
>>> year=utc_date(:,0)
>>> month=utc_date(:,1)
>>>
>>> ;********************************************
>>>
>>> ;*******************************************
>>> ; Create plots
>>> ;*******************************************
>>>
>>> wks = gsn_open_wks("png","ease_map")
>>> gsn_define_colormap(wks,"amwg") ; Change color map
>>>
>>> res = True ; Plot modes desired.
>>> res at gsnMaximize = True ; Maximize plot
>>>
>>> ;---This resource not needed in V6.1.0
>>>
>>> res at gsnSpreadColors = True ; use full range of
>>> colormap
>>>
>>> res at cnFillOn = True ; color plot desired
>>> res at cnLinesOn = False ; turn off contour lines
>>> res at pmLabelBarWidthF = 0.9 ; make wider
>>> res at pmLabelBarHeightF = 0.1 ; default is taller
>>> res at lbLabelFontHeightF = .018 ; default is HUGE
>>>
>>> ; res at cnLevelSelectionMode= "ExplicitLevels" ; set explicit contour
>>> levels
>>> ; res at cnLevels = (/0,1,5,10,25,100,200,300,400/)
>>>
>>> ;************************************************
>>> ;No georeferencing: simple contour. Draws faster
>>> ;************************************************
>>> res at tiMainString = "Polar Plot"
>>> ; plot = gsn_csm_contour(wks,swe(0,:,:),res) ; contour, no map
>>>
>>> ;*******************************************
>>> ; georeferencing: plot on polar projection
>>> ;*******************************************
>>> ; res at trGridType = "TriangularMesh" ; allow missing
>>> coordinates
>>> res at gsnAddCyclic = False
>>> res at gsnPolar = "NH" ; specify the
>>> hemisphere
>>> res at mpMinLatF = 35
>>>
>>> res at tiMainString = "gsn_csm_contour_map_polar"
>>>
>>> plot = gsn_csm_contour_map_polar(wks,swe(0,:,:),res)
>>>
>>>
>>>
>>> On Wed, Jun 1, 2016 at 3:49 PM, Mary Haley <haley at ucar.edu> wrote:
>>>
>>>> Hi Ipshita,
>>>>
>>>> This is indeed strange.
>>>>
>>>> As a quick test, can you try (for the gsn_csm_contour_map plot):
>>>>
>>>> res at gsnAddCyclic = False
>>>>
>>>> Also, are you getting any kind of error messages?
>>>>
>>>> You can also try using raster contours:
>>>>
>>>> res at cnFillMode = "RasterFill"
>>>>
>>>> If you continue to have problems, we may need to take a look at your
>>>> data, and in particular the lat/lon arrays on the file. It looks like you
>>>> are doing everything correctly otherwise.
>>>>
>>>> --Mary
>>>>
>>>>
>>>> On Wed, Jun 1, 2016 at 5:33 PM, Ipshita Majhi <ipmajhi at alaska.edu>
>>>> wrote:
>>>>
>>>>> Dear NCL,
>>>>>
>>>>> I have been trying to plot this map correctly for a long time. I don't
>>>>> know where I am going wrong. I will be grateful if you could guide me on
>>>>> this. I am also attaching the pdf version of the map I am getting.
>>>>>
>>>>> Best Regards
>>>>> Ipshita
>>>>> ;***************************************************
>>>>> ;*******************************************
>>>>> 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"
>>>>> ;*******************************************
>>>>>
>>>>> ;============================================
>>>>> ; set up parameters
>>>>> ;============================================
>>>>>
>>>>> ;********************************************
>>>>> ;This is reading in Snow water equivalent which goes from 0 to 250 mm
>>>>> ; from 1982 to 2012
>>>>> ;********************************************
>>>>>
>>>>> a=addfile("/Users/ipshita/Desktop/GlobsnowV2.0/version02/
>>>>> monthly_82_13.nc","r")
>>>>>
>>>>> swe=a->swe
>>>>>
>>>>> time=a->time
>>>>> lat=a->lat
>>>>> lon=a->lon
>>>>>
>>>>> swe_FillValue=-9.99e+08
>>>>>
>>>>> printVarSummary(swe)
>>>>>
>>>>> utc_date = cd_calendar(time, 0)
>>>>> year=utc_date(:,0)
>>>>> month=utc_date(:,1)
>>>>>
>>>>> ;********************************************
>>>>>
>>>>> ;*******************************************
>>>>> ; Create plots
>>>>> ;*******************************************
>>>>>
>>>>> wks = gsn_open_wks("pdf","ease_map")
>>>>> gsn_define_colormap(wks,"amwg") ; Change color map
>>>>>
>>>>> res = True ; Plot modes desired.
>>>>> res at gsnMaximize = True ; Maximize plot
>>>>>
>>>>> ;---This resource not needed in V6.1.0
>>>>> res at gsnSpreadColors = True ; use full range of
>>>>> colormap
>>>>>
>>>>> res at cnFillOn = True ; color plot desired
>>>>> res at cnLinesOn = False ; turn off contour
>>>>> lines
>>>>> res at pmLabelBarWidthF = 0.9 ; make wider
>>>>> res at pmLabelBarHeightF = 0.1 ; default is taller
>>>>> res at lbLabelFontHeightF = .018 ; default is HUGE
>>>>>
>>>>> res at cnLevelSelectionMode= "ExplicitLevels" ; set explicit contour
>>>>> levels
>>>>> res at cnLevels = (/0,1,5,10,25,100,200,300,400/)
>>>>>
>>>>> ;************************************************
>>>>> ;No georeferencing: simple contour. Draws faster
>>>>> ;************************************************
>>>>> res at tiMainString = "gsn_csm_contour"
>>>>> plot = gsn_csm_contour(wks,swe,res) ; contour, no map
>>>>>
>>>>> ;*******************************************
>>>>> ; georeferencing: plot on polar projection
>>>>> ;*******************************************
>>>>> ; georeference
>>>>> swe at lat2d = a->lat
>>>>> swe at lon2d = a->lon
>>>>>
>>>>> res at trGridType = "TriangularMesh" ; allow missing
>>>>> coordinates
>>>>>
>>>>> res at gsnPolar = "NH" ; specify the
>>>>> hemisphere
>>>>> res at mpMinLatF = 35
>>>>> res at tiMainString = "gsn_csm_contour_map_polar"
>>>>>
>>>>> plot = gsn_csm_contour_map_polar(wks,swe(0,:,:),res)
>>>>>
>>>>>
>>>>> --
>>>>> Ipshita Majhi
>>>>> PhD Candidate
>>>>> University of Alaska , Fairbanks
>>>>> Atmospheric Science Department
>>>>> (907)978-4220 ipmajhi at alaska.edu
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Ipshita Majhi
>>> PhD Candidate
>>> University of Alaska , Fairbanks
>>> Atmospheric Science Department
>>> (907)978-4220 ipmajhi at alaska.edu
>>>
>>
>>
>
>
> --
> Ipshita Majhi
> PhD Candidate
> University of Alaska , Fairbanks
> Atmospheric Science Department
> (907)978-4220 ipmajhi at alaska.edu
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160603/13c1b11f/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ease_map.png
Type: image/png
Size: 357939 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160603/13c1b11f/attachment-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: plot_ease_mod.ncl
Type: application/octet-stream
Size: 2683 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160603/13c1b11f/attachment-0001.obj
More information about the ncl-talk
mailing list