Re: Map display problem

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 17 2011 - 10:02:41 MDT

Hi Lizz,
You're right, the missing area over Antarctica is the issue. The
spherical harmonic routines require the input array to be global and to
not have any missing data.

See the Description section here:
http://www.ncl.ucar.edu/Document/Functions/Contributed/f2gsh_Wrap.shtml

I would suggest that you try using linint2_Wrap:
http://www.ncl.ucar.edu/Document/Functions/Contributed/linint2_Wrap.shtml
Adam

On 06/17/2011 08:25 AM, Lizz Ultee wrote:
> Thanks Adam. I checked and the latitudes are oriented from south to north
> (-59.5 to 89.5, no data over Antarctica). Not sure what is wrong here,
> but remarkably after conversion the plot seems to match up with the map
> underneath better, not worse. Plot(0) is shifted longitudinally--I think
> the prime meridian (0east) and international date line (180east) are
> interchanged?--as well as stretched, but plot(1) is just stretched. I
> tried gsnAddCyclic=False, but that only creates a small blank space down
> the prime meridian in plot(1). I suspect that the issue is the lack of
> data for Antarctica; tried setting res@mpMinLatF=-59 but that only made
> things worse. Attaching a screenshot (.png) of the plot I get out.
> Thanks again,
> Lizz
>
>> Hi Lizz,
>> I don't see anything wrong with your script visually. The calculation of
>> the trend looks fine to me. In the resulting panel plot, does plot(0)
>> look right but plot(1) look off? If so, something is going on with the
>> f2gsh_Wrap conversion. Make sure that your rc array has latitudes
>> oriented from south to north (f2gsh requirement). Use
>> printVarSummary(rc) before the conversion to see if that is the case.
>>
>> If after checking the latitudes you still are having problems with the
>> conversion please write the group back, and include a .gif,.jpg, or .png
>> image of your panel plot so we can see what is going on.
>> Good luck,
>> Adam
>>
>> On 06/16/2011 10:36 AM, Lizz Ultee wrote:
>>> Posting script, as requested. This also returns complaints about the
>>> units in the file being wrong, which I think has something to do with
>>> the
>>> misalignment on the map.
>>>
>>> ;*************************************************
>>> 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 data
>>> ;************************************************
>>> in = addfile("./Data/tws_noah10_1m_7901_1010.nc","r")
>>> water = in->water
>>> lat=in->latitude
>>> lat@units="degrees_north"
>>> lon=in->longitude
>>> lon@units="degrees_east"
>>> time=in->time
>>> wt = water(latitude|:,longitude|:,time|:)
>>> ;************************************************
>>> ; create x and calculate trend
>>> ; regCoef instead of regline
>>> ;************************************************
>>> x = ispan(0,dimsizes(wt&time)-1,1)*1.
>>> rc = regCoef(x,wt)
>>>
>>> rc@long_name = "regression coefficient" ;modelled on NCL example
>>> script here
>>> rc@units = "unitless"
>>> copyatt(rc,wt)
>>> ;**********************************************
>>> ; interpolate to new grid
>>> ;**********************************************
>>> newgrid = f2gsh_Wrap(rc,(/64,128/),0)
>>>
>>> ;=========================================;
>>> ; create plots of original and regridded data
>>> ;=========================================;
>>> wks = gsn_open_wks("pdf" ,"regrid1")
>>> ;gsn_define_colormap(wks,"gui_default") ; choose colormap
>>> plot = new(2, graphic)
>>>
>>> res = True
>>> res@cnFillOn = True
>>> res@gsnSpreadColors = True
>>> res@cnLinesOn = False
>>> res@cnLineLabelsOn = False
>>> res@lbLabelAutoStride = True
>>>
>>> res@gsnDraw = False
>>> res@gsnFrame = False
>>>
>>> plot(0) = gsn_csm_contour_map_ce(wks,rc,res)
>>>
>>> plot(1) = gsn_csm_contour_map_ce(wks,newgrid,res)
>>> ;=========================================;
>>> ; create panel plot
>>> ;=========================================;
>>> gsn_panel(wks, plot,(/2,1/),False)
>>> end
>>>
>>>
>>>
>>>
>>>> offline
>>>>
>>>> [1] regCoef is what you want
>>>>
>>>> [2] You should post a *clean* version of your script or, at least,
>>>> the relevant portions of the script to ncl-talk.
>>>>
>>>> Please do not reply directly to me.
>>>>
>>>> Good luck
>>>>
>>>> On 6/16/11 8:23 AM, Lizz Ultee wrote:
>>>>> Hi NCL Talk,
>>>>> I'm a new user of NCL and do not have much programming experience
>>>>> besides,
>>>>> so please excuse any confusion.
>>>>> I'm attempting to calculate a trend for each point of a dataset and
>>>>> then
>>>>> interpolate this info to a Gaussian grid. There are a few issues when
>>>>> I
>>>>> try to do this:
>>>>> 1) Error messages display when I try to get the trend using regline.
>>>>> I
>>>>> can use regCoef but I'm not sure this is what I need. Previously, I
>>>>> calculated the trend at specific points using regline and had no
>>>>> problems,
>>>>> but now (calculating for each point of the dataset) error messages
>>>>> about
>>>>> the dimensionality come up. The range of values returned by regline
>>>>> is
>>>>> not the same as those returned by regCoef, and I don't know why this
>>>>> should be.
>>>>> 2) I have regridded what I got out of regCoef and plotted the results
>>>>> on
>>>>> a
>>>>> contour map, original vs. Gaussian grid. It looks fine except that
>>>>> the
>>>>> plot is not lined up with the underlying map; the data very clearly
>>>>> shows
>>>>> outlines of the continents but these are in the wrong place. Does
>>>>> this
>>>>> matter in the grand scheme of things? I just need values on the
>>>>> Gaussian
>>>>> grid (in a NetCDF for example) to proceed with analysis--the plot will
>>>>> not
>>>>> play a part in my final product.
>>>>>
>>>>> Thanks in advance for any suggestions anyone has!
>>>>> Best,
>>>>> Lizz Ultee
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>
>> --
>> ______________________________________________________________
>> Adam Phillips asphilli@ucar.edu
>> NCAR/Climate and Global Dynamics Division (303) 497-1726
>> P.O. Box 3000
>> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
>> _______________________________________________
>> 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

-- 
______________________________________________________________
Adam Phillips                                asphilli@ucar.edu
NCAR/Climate and Global Dynamics Division       (303) 497-1726
P.O. Box 3000				
Boulder, CO 80307-3000    http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jun 17 10:02:58 2011

This archive was generated by hypermail 2.1.8 : Mon Jun 20 2011 - 12:30:20 MDT