Re: ncl-talk Digest, Vol 99, Issue 38

From: Owanda Otieno <owandaotieno_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 02 2012 - 08:37:52 MST

Thanks Adam,

   worked with the test that have so far done.

   Thanks again
   Owanda.

>
> ------------------------------
>
> Message: 2
> Date: Tue, 28 Feb 2012 14:11:45 -0700
> From: Adam Phillips <asphilli@ucar.edu>
> Subject: Re: cordinate error
> To: ncl-talk@ucar.edu
> Message-ID: <4F4D4311.3080309@ucar.edu>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Owanda,
> I see you have 2 dimensional latitudes/longitudes. However, the file is
> not CF (or COARDS)-compliant, in that the 2D lat/lon arrays have named
> dimensions "lat" and "lon". Looking at the latitude/longitude arrays it
> looks like they are repeating. (Try typing ncdump -v lon
> AFRICA_UC-WRF311_CTL_ERAINT_MM_50km_1989-2008_pr.nc | less)
>
> Thus, we can strip out one set of latitudes/longitudes and assign them
> as 1 dimensional latitude/longitude coordinate variables, and then
> subset them using coordinate subscripting: (you should verify that this
> is OK by examining the data file in more detail)
>
> pr = f->pr ; (:,:,:)
> pr = (/ pr*86400 /)
> pr@units = "Kg/m2-day"
> printVarSummary(pr) ; variable overview
>
> pr&lat = f->lat(:,0)
> pr&lon = f->lon(0,:)
>
> x = pr(:,{latS:latN},{lonL:lonR})
> delete(pr)
>
> I have attached a modified version of your script. If you have further
> questions on this matter, please respond to ncl-talk.
> Good luck,
> Adam
>
> On 02/28/2012 09:33 AM, Owanda Otieno wrote:
> >
> > Dear all,
> > Have been experiencing a couple of problems in eof analysis using some
> > of the scripts on ncl sites. Through have tried using some of the
> > experiences before, posted online, have not managed to solve my
> > difficulties.
> > Any suggestion is really appreciated.
> > *
> > Please see process below;*
> >
> > Variable: eof_ts
> > Type: float
> > Total Size: 2880 bytes
> > 720 values
> > Number of Dimensions: 2
> > Dimensions and sizes: [evn | 3] x [time | 240]
> > Coordinates:
> > evn: [1..3]
> > Number Of Attributes: 3
> > ts_mean : ( -59.76283, -171.605, 35.54322 )
> > matrix : covariance
> > _FillValue : 1e+30
> > (0) check_for_y_lat_coord: Warning: Data either does not contain a
> > valid latitude coordinate array or doesn't contain one at all.
> > (0) A valid latitude coordinate array should have a 'units'
> > attribute equal to one of the following values:
> > (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees
> > north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN'
> > 'deg north'
> >
> > .
> > .
> > .
> > 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> > 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> > (0) check_for_lon_coord: Warning: Data either does not contain a
> > valid longitude coordinate array or doesn't contain one at all.
> > (0) A valid longitude coordinate array should have a 'units'
> > attribute equal to one of the following values:
> > (0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> > 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
> > fatal:No coordinate variable exists for dimension (time) in variable
> > (eof_ts)
> > fatal:Execute: Error occurred at or near line 144 in file eofcordex3.ncl
> >
> >
> > ***modified scipt :**
> > **
> > *; ==============================================================
> > 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
> > ; ==============================================================
> > ; User defined parameters that specify region of globe and
> > ; ==============================================================
> > latS = -12.
> > latN = 23.
> > lonL = 20.
> > lonR = 60.
> >
> > yrStrt = 1989
> > yrLast = 2008
> >
> > season = "MAM"
> >
> > neof = 3
> > optEOF = True
> > optEOF@jopt = 0
> > optETS = False
> >
> > ; ==============================================================
> > ; Open the file: Read only the user specified period
> > ; ==============================================================
> > dir = "/scratch/DATA/CORDEX/UC-WRF/"
> > f = addfile
> > (dir+"AFRICA_UC-WRF311_CTL_ERAINT_MM_50km_1989-2008_pr.nc", "r")
> >
> > TIME = f->time
> > YYYY = cd_calendar(TIME, -1)/100
> > iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
> >
> > pr = f->pr(:,:,:)
> > print(dimsizes(pr))
> > x = pr*86400
> > printVarSummary(x) ; variable overview
> >
> > nlat = 249
> > nlon = 209
> > lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
> > lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")
> >
> > printVarSummary(lat)
> > printVarSummary(lon)
> >
> > x!0 = "time"
> > x!1 = "lat"
> > x!2 = "lon"
> > ; x&lat = x&lat
> > ; x&lon = x&lon
> >
> > ; x&time = Months
> > ; x&lat = "degrees_north"
> > ; x&lon = "degrees_east"
> >
> > printVarSummary(x)
> >
> > ; x&lat@units = "degrees_north"
> > ; x&lon@units = "degrees_east"
> > ; ==============================================================
> > ;compute desired monthly climatology and monthly anomalies
> > ;===============================================================
> >
> > xClm = clmMonTLL(x)
> > printVarSummary(xClm)
> >
> > xAnom = calcMonAnomTLL(x,xClm)
> > printVarSummary(xAnom)
> >
> > ; ================================================================
> > ; Reorder (lat,lon,time) the *weighted* input data
> > ; Access the area of interest via coordinate subscripting
> > ; ================================================================
> > ; xr = xAnom(lat|:,lon|:,time|:)
> > xr = x(lat|:,lon|:,time|:)
> >
> > eof = eofunc_Wrap(xr, neof, optEOF)
> > ; eof =-1*eof
> > eof_ts = eofunc_ts_Wrap (xr, eof, optETS)
> >
> > printVarSummary( eof )
> > printVarSummary( eof_ts )
> >
> > ;============================================================
> > ; PLOTS
> > ;============================================================
> > xwks = gsn_open_wks("x11","eof")
> > pswks = gsn_open_wks("eps","Africa-WRF-Cordex_eof-mam1989-2008")
> > gsn_define_colormap(xwks,"BlWhRe") ; choose colormap
> > gsn_define_colormap(pswks,"BlWhRe")
> > plot = new(neof,graphic) ; create graphic array
> > ; only needed if paneling
> > ; EOF patterns
> >
> > res = True
> > res@gsnDraw = False ; don't draw yet
> > res@gsnFrame = False ; don't advance frame yet
> > res@gsnSpreadColors = True ; spread out color table
> > res@gsnAddCyclic = False ; plotted dataa are not cyclic
> >
> > res@mpFillOn = False ; turn off map fill
> > res@mpOutlineBoundarySets = "National"
> > res@mpGeophysicalLineColor = "Navy"
> > ; res@mpGeophysicalLineThickness = 1.5
> >
> > res@mpMinLatF = latS ; zoom in on map
> > res@mpMaxLatF = latN
> > res@mpMinLonF = lonL
> > res@mpMaxLonF = lonR
> >
> > res@cnFillOn = True ; turn on color fill
> > res@cnLinesOn = False ; True is default
> > ; res@cnLineLabelsOn = False ; True is default
> > res@lbLabelBarOn = False ; turn off individual lb's
> >
> > ; set symmetric plot min/max
> > symMinMaxPlt(eof, 16, False, res) ; contributed.ncl
> >
> > ; panel plot only resources
> > resP = True ; modify the panel plot
> > resP@gsnMaximize = True ; large format
> > resP@gsnPanelLabelBar = True ; add common colorbar
> > resP@lbLabelAutoStride = True ; auto stride on
> >
> > ;*******************************************
> > ; first plot
> > ;*******************************************
> > do n=0,neof-1
> > res@gsnLeftString = "EOF "+(n+1)
> > res@gsnRightString = sprintf("%5.1f", eof@pcvar(n)) +"%"
> > plot(n)=gsn_csm_contour_map_ce(xwks,eof(n,:,:),res)
> > plot(n)=gsn_csm_contour_map_ce(pswks,eof(n,:,:),res)
> > end do
> > gsn_panel(xwks,plot,(/neof,1/),resP) ; now draw as one plot
> > gsn_panel(pswks,plot,(/neof,1/),resP)
> >
> > ;*******************************************
> > ; second plot
> > ;*******************************************
> > ;; EOF time series [bar form]
> >
> > time = eof_ts&time
> > do n=0,neof-1
> > ascii_file1 = "WRF-cordex_eof1-mam1989-2008.txt"
> > ascii_file2 = "WRF-cordex_eof2-mam1989-2008.txt"
> > ascii_file3 = "WRF-cordex_eof3-mam1989-2008.txt"
> >
> > asciiwrite(ascii_file1,eof_ts(0,:))
> > asciiwrite(ascii_file2,eof_ts(1,:))
> > asciiwrite(ascii_file3,eof_ts(2,:))
> > end do
> > end
> >
> > script also attached.
> >
> > You can find my data here :
> >
> https://dropbox.uconn.edu/dropbox?n=AFRICA_UC-WRF311_CTL_ERAINT_MM_50km_1989-2008_pr.nc&p=WzAFDxwPm1IMFjpIL
> > <
> https://dropbox.uconn.edu/dropbox?n=AFRICA_UC-WRF311_CTL_ERAINT_MM_50km_1989-2008_pr.nc&p=WzAFDxwPm1IMFjpIL
> >
> >
> > Thanks in advance.
> > --
> > Owanda Otieno
> > Department of Natural Resources and the Environment
> > University of Connecticut
> > 1376 Storrs Road, Unit 4087
> > Storrs, CT 06269-4087
> > Phone: (860) 486-1876 <tel:%28860%29%20486-1876>
> >
> >
> >
> >
> > --
> > Owanda Otieno
> > Department of Natural Resources and the Environment
> > University of Connecticut
> > 1376 Storrs Road, Unit 4087
> > Storrs, CT 06269-4087
> > Phone: (860) 486-1876 <tel:%28860%29%20486-1876>
> >
> >
> >
> >
> > --
> > Owanda Otieno
> > Department of Natural Resources and the Environment
> > University of Connecticut
> > 1376 Storrs Road, Unit 4087
> > Storrs, CT 06269-4087
> > Phone: (860) 486-1876
> >
> >
> >
> > _______________________________________________
> > 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
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120228/f57b2e43/attachment.html
> -------------- next part --------------
> An embedded and charset-unspecified text was scrubbed...
> Name: eofcordex3.ncl
> Url:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120228/f57b2e43/attachment.pl
>
> ------------------------------
>
> Message: 3
> Date: Tue, 28 Feb 2012 17:08:34 -0700
> From: Mingxuan Chen <chen@atmos.colostate.edu>
> Subject: Re: calculating laplacian in NCL
> To: Dennis Shea <shea@ucar.edu>
> Cc: ncl-talk@ucar.edu
> Message-ID: <C1DD391C-8398-4927-B218-758B8292E638@atmos.colostate.edu>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi Dennis,
> Please see test results. Both figures are from same file (
> 144X90,without missing values). Figure1 is using lap.f90, second one is
> using ncl function lapsF to calculate laplacian.
> How do you evaluate the lap.f90?
> Thanks
> Mingxuan
>
> Fig1
>
> Fig2
>
>
> >
> >
> > On Feb 24, 2012, at 3:43 PM, Dennis Shea wrote:
> >
> >> This is offline.
> >>
> >> Maybe someone has done it. Don't know.
> >>
> >> Attached is an old fortran subroutine that is untested.
> >>
> >>
> >> On 02/24/2012 10:26 AM, Mingxuan Chen wrote:
> >>> Hello,
> >>> There are functions lapsF and lapsG to calculate laplacian in NCL,
> but they don't handle missing values. How do calculate laplacian with
> missing values in NCL? Did anyone already write a function/subroutine to
> handle missing values?
> >>> Thank you for your help.
> >>> Mingxuan
> >>> _______________________________________________
> >>> ncl-talk mailing list
> >>> List instructions, subscriber options, unsubscribe:
> >>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >>
> >> <lap.f>
> >
>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120228/fd22cfdf/attachment.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: lap_GFDL0.ps
> Type: image/ps
> Size: 131180 bytes
> Desc: not available
> Url :
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120228/fd22cfdf/attachment.bin
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120228/fd22cfdf/attachment-0001.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: lap2_GFDL0.ps
> Type: image/ps
> Size: 197620 bytes
> Desc: not available
> Url :
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120228/fd22cfdf/attachment-0001.bin
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120228/fd22cfdf/attachment-0002.html
>
> ------------------------------
>
> Message: 4
> Date: Wed, 29 Feb 2012 01:55:25 -0800 (PST)
> From: Mark Chan <cym263@yahoo.com>
> Subject: Re: transform a projection into regular lat-lon
> To: David Brown <dbrown@ucar.edu>
> Cc: NCL Helpline <ncl-talk@ucar.edu>
> Message-ID:
> <1330509325.86872.YahooMailNeo@web161401.mail.bf1.yahoo.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Dear David,
>
> I still have problem for plot. The original data is very large and I made
> the annual average (by using CDO) for making the file smaller, as the
> attached file.
> The original file has rotated info as in the below, but the CDO-processed
> file doesn't have this info. Could you please help have a look at the data
> and give a plot suggestion?
>
> Thanks so much!
> Mark
> ???????
>
> char rotated_pole ;
> ??????????????? rotated_pole:long_name = "coordinates of the rotated North
> Pole" ;
> ??????????????? rotated_pole:grid_mapping_name =
> "rotated_latitude_longitude" ;
> ??????????????? rotated_pole:grid_north_pole_latitude = 39.25f ;
> ??????????????? rotated_pole:grid_north_pole_longitude = -162.f ;
>
>
>
>
> ________________________________
> From: David Brown <dbrown@ucar.edu>
> To: Mark Chan <cym263@yahoo.com>
> Cc: NCL Helpline <ncl-talk@ucar.edu>
> Sent: Tuesday, February 28, 2012 6:18 PM
> Subject: Re: transform a projection into regular lat-lon
>
>
> Hi Mark,
> Since the NCL is looking for the center longitude and you have the north
> pole, I think you should try setting mpCenterLatF to 39.25 - 90. Let us
> know if that does not produce a reasonable plot.
> ?-dave
>
>
>
> On Feb 28, 2012, at 6:11 AM, Mark Chan wrote:
>
> Dear Dennis,
> >
> >
> >Thanks a lot for your message. I wonder whether I could find the input
> data for the example in the website, so I could compare it with my data.
> >For instance, how could I get the parameters as in the below since my
> data has something like "grid_north_pole_latitude : 39.25".
> >res@mpCenterLonF = lon2d@Longitude_of_southern_pole
> >res@mpCenterLatF = lon2d@Latitude_of_southern_pole + 90
> >
> >Thanks a lot again!
> >
> >
> >Mark
> >
> >
> >________________________________
> > From: Dennis Shea <shea@ucar.edu>
> >To: Mark Chan <cym263@yahoo.com>
> >Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
> >Sent: Monday, February 27, 2012 5:39 PM
> >Subject: Re: transform a projection into regular lat-lon
> >
> >Does
> >? ? http://www.ncl.ucar.edu/Applications/rotatedltln.shtml
> >answer your question. Please read the text.
> >
> >Good Luck
> >
> >On 2/27/12 3:31 AM, Mark Chan wrote:
> >> Dear NCL users,
> >>
> >> I have a model output file having info as in the below. I was told it is
> >> "rotated projection" (I don't know exactly what it is).
> >> Could any one help give me a suggestion how to transform this data into
> >> regular lat-lon projection? The main issue is how to define its
> >> projection when reading it with NCL?
> >>
> >> Thanks so much in advance!
> >> Mark Chan
> >>
> >> ----------------------Data file info ------------------------
> >> dimensions:
> >> ncl_scalar = 1
> >> rlat = 92
> >> rlon = 108
> >> time = 87648 // unlimited
> >> height_2m = 1
> >> variables:
> >> double time ( time )
> >> standard_name : time
> >> units : seconds since 1989-01-01 00:00:00
> >>
> calendar : standard
> >> float rlon ( rlon )
> >> standard_name : grid_longitude
> >> units : degrees
> >> float rlat ( rlat )
> >> standard_name : grid_latitude
> >> units : degrees
> >> float lon ( rlat, rlon )
> >> standard_name : longitude
> >> units : degrees_east
> >> float lat ( rlat, rlon )
> >> standard_name : latitude
> >> units : degrees_north
> >> float height_2m ( height_2m )
> >> long_name : height above surface
> >> units : m
> >> character rotated_pole ( ncl_scalar )
> >> long_name : coordinates of the rotated North Pole
> >> grid_mapping_name : rotated_latitude_longitude
> >> grid_north_pole_latitude : 39.25
> >> grid_north_pole_longitude : -162
> >> short tas ( time, height_2m, rlat, rlon )
> >> standard_name : air_temperature
> >> long_name : 2m temperature
> >> units : K
> >> coordinates : lon lat
> >> scale_factor : 0.004940663
> >> add_offset :
> 161.8932
> >> ====================================
> >>
> >> -----------------Its grids info is
> >> as-----------------------------------------------------
> >> rlon = -10.445, -10.335, -10.225, -10.115, -10.005, -9.895, -9.785,
> -9.675,
> >> -9.565, -9.455, -9.345, -9.235, -9.125, -9.015, -8.905, -8.795, -8.685,
> >> -8.575, -8.465, -8.355, -8.245, -8.135, -8.025, -7.915, -7.805, -7.695,
> >> -7.585, -7.475, -7.365, -7.255, -7.145, -7.035, -6.925, -6.815, -6.705,
> >> -6.595, -6.485, -6.375, -6.265, -6.155, -6.045, -5.935, -5.825, -5.715,
> >> -5.605, -5.495, -5.385, -5.275, -5.165, -5.055, -4.945, -4.835, -4.725,
> >> -4.615, -4.505, -4.395, -4.285, -4.175, -4.065, -3.955, -3.845, -3.735,
> >> -3.625, -3.515, -3.405, -3.295, -3.185, -3.075, -2.965, -2.855, -2.745,
> >> -2.635, -2.525, -2.415, -2.305, -2.195, -2.085, -1.975, -1.865, -1.755,
> >> -1.645, -1.535, -1.425, -1.315, -1.205, -1.095, -0.985, -0.875,
> -0.765,
> >> -0.655, -0.545, -0.435, -0.325, -0.215, -0.105, 0.005, 0.115, 0.225,
> >> 0.335, 0.445, 0.555, 0.665, 0.775, 0.885, 0.995, 1.105, 1.215, 1.325 ;
> >>
> >> rlat = -8.855, -8.745, -8.635, -8.525, -8.415, -8.305, -8.195, -8.085,
> >> -7.975, -7.865, -7.755, -7.645, -7.535, -7.425, -7.315, -7.205, -7.095,
> >> -6.985, -6.875, -6.765, -6.655, -6.545, -6.435, -6.325, -6.215, -6.105,
> >> -5.995, -5.885, -5.775, -5.665, -5.555, -5.445, -5.335, -5.225, -5.115,
> >> -5.005, -4.895, -4.785, -4.675, -4.565, -4.455, -4.345, -4.235, -4.125,
> >> -4.015, -3.905, -3.795, -3.685, -3.575, -3.465, -3.355, -3.245, -3.135,
> >> -3.025, -2.915, -2.805, -2.695, -2.585, -2.475, -2.365, -2.255, -2.145,
> >> -2.035, -1.925, -1.815, -1.705, -1.595, -1.485, -1.375, -1.265, -1.155,
> >> -1.045, -0.935, -0.825, -0.715, -0.605, -0.495, -0.385, -0.275, -0.165,
> >> -0.055, 0.055, 0.165, 0.275, 0.385, 0.495, 0.605, 0.715, 0.825,
> 0.935,
> >> 1.045, 1.155 ;
> >>
> >>
> >>
> >>
> >> _______________________________________________
> >> 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
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120229/8cc06655/attachment.html
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Rotated_2009.nc
> Type: application/x-netcdf
> Size: 101492 bytes
> Desc: not available
> Url :
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20120229/8cc06655/attachment.nc
>
> ------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> End of ncl-talk Digest, Vol 99, Issue 38
> ****************************************
>

-- 
Owanda Otieno
Department of Natural Resources and the Environment
University of Connecticut
1376 Storrs Road, Unit 4087
Storrs, CT 06269-4087
Phone: (860) 486-1876

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 2 08:38:07 2012

This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST