Re: Map display problem

From: Lizz Ultee <lultee_at_nyahnyahspammersnyahnyah>
Date: Thu Jun 16 2011 - 10:36:38 MDT

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
Received on Thu Jun 16 10:36:48 2011

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