#$=head1 NAME #$ #$binpull1 - nearest neighbor interpolation #$ #$=head1 SYNOPSIS #$ #$Initializer : C #$ #$Operator : C #$ #$=head1 PARAMETERS #$ #$=over 4 #$ #$=item o1 - real #$ #$ first sample of model space #$ #$=item d1 - real #$ #$ sampling of model space #$ #$=item coordinte - C #$ #$ location of data #$ #$=item m1 - integer #$ #$ number of model points #$ #$=item adj,add,model,data - #$ #$ standard operator #$ #$=back #$ #$=head1 DESCRIPTION #$ #$1-D nearest neighbor interpolation #$ #$=head1 SEE ALSO #$ #$L,L,L #$ #$=head1 LIBRARY #$ #$B #$ #$=cut #$ module binpull1 { # From each bin on model mesh, pull nearest data value. integer, dimension (m1), allocatable :: jd integer :: m1 #% _init( o1, d1, coordinate, m1) integer im, id real x, near, dist, o1,d1,coordinate(:) do im= 1, m1 { x = o1 + (im-1)*d1 near = 1.e30 do id= 1, size(coordinate) { dist = abs( x -coordinate(id)) if( dist < near) { jd(im) = id near = dist } } } #% _lop ( mm, dd) integer im,id do im= 1, m1 { id = jd(im) if( adj) mm(im) = mm(im) + dd(id) else dd(id) = dd(id) + mm(im) } }