Elementwise maximum

From: <Oliver.Fuhrer_at_nyahnyahspammersnyahnyah>
Date: Wed, 29 Jul 2009 08:35:29 +0200

Hi!

Something I really appreciate in Fortran (and also NCL of course) is the
array syntax. In Fortran there is a distinction between max (elementwise
maximum) and maxval (maximum of an array). In NCL I have not found such
an elementwise operator. Up to now I use the construct (for 3D
arrays)...

s=dimsizes(v1)
tmp1=conform_dims((/1,s(0),s(1),s(2)/),v1,(/1,2,3/))
tmp2=conform_dims((/1,s(0),s(1),s(2)/),v2,(/1,2,3/))
tmp3=array_append_record(tmp1,tmp2,0)
vmax=dim_max_n(tmp3,(/0/))
delete(tmp1)
delete(tmp2)
delete(tmp3)

...which in Fortran would simply be...

vmax=max(v1,v2)

The NCL formulation uses more than twice as much memory and is dependent
on the number of dimensions. Is there a function that does something
like this or is there a more elegant way of doing this?

Thanks for any advice,
Oli
 
________________________________________

Oliver Fuhrer
Numerical Models

Federal Departement of Home Affairs FDHA
Federal Office of Meteorology and Climatology MeteoSwiss

Kraehbuehlstrasse 58, P.O. Box 514, CH-8044 Zurich, Switzerland

Tel. +41 44 256 93 59
Fax +41 44 256 92 78
oliver.fuhrer_at_meteoswiss.ch
www.meteoswiss.ch - First-hand information
  
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jul 29 2009 - 00:35:29 MDT

This archive was generated by hypermail 2.2.0 : Wed Jul 29 2009 - 09:07:41 MDT