[248] | 1 | SUBROUTINE HISTOGRAM2D(N,X,Y,Z,NXBINS,NYBINS,XLIM,YLIM,DX,DY, |
---|

| 2 | 1 NST,HST) |
---|

[232] | 3 | |
---|

[247] | 4 | Cf2py intent(in) n |
---|

| 5 | Cf2py intent(in) x |
---|

| 6 | Cf2py depend(n) x |
---|

| 7 | Cf2py intent(in) y |
---|

| 8 | Cf2py depend(n) y |
---|

| 9 | Cf2py intent(in) z |
---|

| 10 | Cf2py depend(n) z |
---|

| 11 | Cf2py intent(in) nxbins |
---|

| 12 | Cf2py intent(in) nybins |
---|

| 13 | Cf2py intent(in) xlim |
---|

[248] | 14 | Cf2py intent(in) ylim |
---|

| 15 | Cf2py intent(in) dx |
---|

| 16 | Cf2py intent(in) dy |
---|

| 17 | Cf2py intent(in,out) nst |
---|

[247] | 18 | Cf2py depend(nxbins,nybins) nst |
---|

[248] | 19 | Cf2py intent(in,out) hst |
---|

[247] | 20 | Cf2py depend(nxbins,nybins) hst |
---|

[232] | 21 | |
---|

| 22 | IMPLICIT NONE |
---|

[450] | 23 | INTEGER*8 N |
---|

[232] | 24 | REAL*4 X(0:N-1),Y(0:N-1),Z(0:N-1) |
---|

[248] | 25 | INTEGER*8 NXBINS,NYBINS |
---|

[232] | 26 | REAL*8 XLIM(0:1),YLIM(0:1) |
---|

[248] | 27 | REAL*4 NST(0:NXBINS-1,0:NYBINS-1) |
---|

| 28 | REAL*4 HST(0:NXBINS-1,0:NYBINS-1) |
---|

[232] | 29 | |
---|

| 30 | INTEGER*4 I,J,K |
---|

| 31 | REAL*8 DX,DY |
---|

[451] | 32 | REAL*4 DDX,DDY |
---|

[271] | 33 | DO K=0,N-1 |
---|

[451] | 34 | C if ( mod(k,8000) .eq. 0 ) |
---|

| 35 | C 1 print *,k,x(k),xlim,y(k),ylim |
---|

| 36 | IF ( ( X(K).GE.XLIM(0) .AND. X(K).LT.XLIM(1) ) .AND. |
---|

| 37 | 1 ( Y(K).GE.YLIM(0) .AND. Y(K).LT.YLIM(1) )) THEN |
---|

| 38 | DDX = (X(K)-XLIM(0))/DX |
---|

[3522] | 39 | I = MIN(MAX(0,INT(DDX)),NXBINS-1) |
---|

[451] | 40 | DDY = (Y(K)-YLIM(0))/DY |
---|

[3522] | 41 | J = MIN(MAX(0,INT(DDY)),NYBINS-1) |
---|

[274] | 42 | NST(I,J) = NST(I,J)+1.0 |
---|

| 43 | HST(I,J) = HST(I,J)+Z(K) |
---|

[451] | 44 | C if ( mod(k,8000) .eq. 0 ) |
---|

| 45 | C 1 print *,i,j,nst(i,j),hst(i,j) |
---|

[232] | 46 | END IF |
---|

| 47 | END DO |
---|

| 48 | RETURN |
---|

| 49 | END |
---|