Hi Alex,
local_min / local_max only accept 2 dimensional data:
http://www.ncl.ucar.edu/Document/Functions/Built-in/local_min.shtml
As you have 3D data, you need to put in a do loop for the time dimension:
t = x&time
do gg = 0,dimsizes(t)-1
nmin = local_min(x(gg,:,:), True, delta)
print("For t = "+t(gg)+", local_min exists at "+nmin_at_yi+"N, \
"+nmin_at_xi+"E, with a value of "+nmin_at_minval)
end do
Adam
Alex Gardner wrote:
> Thanks again Dennis, you've been a great help.
>
> I've tired running the scrip but I keep getting the error message:
>
> "Fatal: Number of dimensions in parameter (0) of (local_min) is (3), (2)
> dimensions were expected"
>
> The scrip I have so for is:
>
> a = addfile("$NCARG_ROOT/netcdf/hgt.2002.nc","r")
> x=a->hgt(:,5,{60:},:)
>
> t = x&time
> ntim = dimsizes(t)
>
> delta = 0. ; user specified
> nmin = local_min(x, True, delta)
>
> ncol = 4
> data = new ( (/ntim,ncol/) , typeof(x) )
> data(:,0) = t
> data(:,1) = nmin_at_minval
> data(:,2) = nmin_at_xi
> data(:,3) = nmin_at_yi
>
> opt = True
> opt_at_fout = "alexg.txt"
> write_matrix( data, "f10.1,3f10.2", opt)
>
> end
>
> The problem has to do with the time component of the field "hgt". Local_min
> doesn't seem to work when all time steps are extracted.
>
> Do you know how can I solve this issue?
>
> Alex
>
> -----Original Message-----
> From: Dennis Shea [mailto:shea_at_cgd.ucar.edu]
> Sent: Tuesday, May 02, 2006 2:46 PM
> To: ncl-talk_at_ucar.edu; alexg_at_ualberta.ca
> Subject: RE: [ncl-talk] High Pressure Ridge Identification Algorithm?
>
>
>>Thank you very much for the help Dennis,
>>
>>The min and max functions will do what I want. What I eventually want to do
>>is output the min value, lat and long for each month of a 2 year monthly
>>mean netCDF file for the region North of 60 deg North. Ideally I would like
>>to run a script that could output a single txt file with the year, month,
>>value, lat, and long for each month of the 24 months the netCDF. Does
>
> anyone
>
>>have a script where they have used the locmin or locmax functions with a
>>netcdf file and output the results as a txt file?
>>
>>Any help would be greatly appreciated.
>
>
> quick/dirty/ and untested
>
> f = addfile (... , "r")
> ; read data nort of 60
> x = f->X(:,{60:},:) ; x(time,lat,lon) => (24,:,:)
> t = x&time
> ntim = dimsizes(t)
>
> delta = ... ; user specified
> nmin = local_min(x, True, delta)
> ; ????
> ncol = 4
> data = new ( (/ntim,ncol/) , typeof(x) )
> data(:,0) = t
> data(:,1) = nmin_at_minval
> data(:,2) = nmin_at_xi
> data(:,3) = nmin_at_yi
>
> opt = True
> opt_at_fout = "alexg.txt"
> write_matrix( data, "f10.1,3f10.2", opt)
>
>
>>
>>
>>-----Original Message-----
>>From: Dennis Shea [mailto:shea_at_cgd.ucar.edu]
>>Sent: Monday, May 01, 2006 3:35 PM
>>To: ncl-talk_at_ucar.edu; alexg_at_ualberta.ca
>>Subject: Re: High Pressure Ridge Identification Algorithm?
>>
>>
>>>I know it's a long shot, but does anyone know if there is an atmospheric
>>>ridge detection (from netCDF files) function that has been developed for
>>>NCL? I'm looking to develop statistics on ridging event over a particular
>>>region and was hoping that maybe someone has done similar work.
>>>_______________________________________________
>>
>>I know of no ready made software.
>>
>>---
>>Having said that ...
>>
>>What do you mean by "atmospheric ridge detection"?
>>
>>Are you talking about atmospheric "blocks" ?
>>ie: blocking highs , blocking patterns
>>
>>---
>>There are functions that can automate detection
>>of local min and max of 2D fileds
>>
>>
>>http://www.ncl.ucar.edu/Document/Functions/Built-in/local_max.shtml
>>
>>An example is at:
>>http://www.ncl.ucar.edu/Applications/minmax.shtml
>>
>>good luck
>>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- -------------------------------------------------------------- Adam Phillips asphilli_at_ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD/CAS fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list ncl-talk_at_ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talkReceived on Wed May 03 2006 - 14:02:55 MDT
This archive was generated by hypermail 2.2.0 : Wed May 03 2006 - 14:51:02 MDT