Dear all
I just updated the t2d_wind_txy.f sobroutine in wind_txy example to have interpolated values in all time steps.
The problem that I found is that the wind was updated only for AT time equal to AT step in the winf file f01_wind_txy.
I added some lines to the fortran IDWM to get full interpolation.
! #######################################################################
! IDWM WIND INTERPOLATION CODE
! #######################################################################
!
PI = ACOS(-1.D0)
!
! ASSEMBLE THE ARRAYS OF X,Y,WNDSPD AND X,Y,WNDDIR FOR EACH ITERATION
DO A = 1,NUMPOINTS
IF(AT_WIND(A).EQ.AT) THEN
DO B = 1,NUMSTA
! ASSEMBLE THE ARRAYS FOR THIS TIME STEP
INPSTA_D(B,1) = XX(
INPSTA_D(B,2) = YY(
INPSTA_D(B,3) = WIND(A,B*2+1)
INPSTA_S(B,1) = XX(
INPSTA_S(B,2) = YY(
INPSTA_S(B,3) = WIND(A,B*2)
ENDDO
ENDIF
! interpolate FOR EACH ITERATION
IF((AT_WIND(A).LT.AT).AND.(AT_WIND(A).NE.AT)) THEN
DO B = 1,NUMSTA
! ASSEMBLE THE ARRAYS FOR THIS TIME STEP
INPSTA_D(B,1) = XX(
INPSTA_D(B,2) = YY(
INPSTA_D(B,3) = (WIND(A+1,B*2+1)-WIND(A,B*2+1))
& *(AT-AT_WIND(A))/(AT_WIND(A+1)-AT_WIND(A))+WIND(A,B*2+1)
INPSTA_S(B,1) = XX(
INPSTA_S(B,2) = YY(
INPSTA_S(B,3) = (WIND(A+1,B*2)-WIND(A,B*2))
& *(AT-AT_WIND(A))/(AT_WIND(A+1)-AT_WIND(A))+WIND(A,B*2)
ENDDO
ENDIF
ENDDO
!
CALL IDWM_T2D(INPSTA_S,POINTS,OUT_WSPD,NPOIN,NUMSTA)
CALL IDWM_T2D(INPSTA_D,POINTS,OUT_WDIR,NPOIN,NUMSTA)
!
! CONVERT OUT_WSPD AND OUT_WDIR TO WINDX AND WINDY
DO K = 1,NPOIN
IF(OUT_WDIR(K).GE.0.D0.AND.OUT_WSPD(K).GE.0.D0) THEN
IF(OUT_WDIR(K).GE.0.D0.AND.OUT_WDIR(K).LE.90.D0) THEN
THETA_RAD = OUT_WDIR(K)*PI/180.D0
WINDX(K) = -SIN(THETA_RAD)*OUT_WSPD(K)
WINDY(K) = -COS(THETA_RAD)*OUT_WSPD(K)
ENDIF
!
IF(OUT_WDIR(K).GT.90.D0.AND.OUT_WDIR(K).LE.180.D0) THEN
THETA_RAD = (180.D0-OUT_WDIR(K))*PI/180.D0
WINDX(K) = -SIN(THETA_RAD)*OUT_WSPD(K)
WINDY(K) = COS(THETA_RAD)*OUT_WSPD(K)
ENDIF
!
IF(OUT_WDIR(K).GT.180.D0.AND.OUT_WDIR(K).LE.270.D0) THEN
THETA_RAD = (OUT_WDIR(K)-180.D0)*PI/180.D0
WINDX(K) = SIN(THETA_RAD)*OUT_WSPD(K)
WINDY(K) = COS(THETA_RAD)*OUT_WSPD(K)
ENDIF
!
IF(OUT_WDIR(K).GT.270.D0.AND.OUT_WDIR(K).LE.360.D0) THEN
THETA_RAD = (360.D0-OUT_WDIR(K))*PI/180.D0
WINDX(K) = SIN(THETA_RAD)*OUT_WSPD(K)
WINDY(K) = -COS(THETA_RAD)*OUT_WSPD(K)
ENDIF
ELSE
WINDX(K) = -999.D0
WINDY(K) = -999.D0
WRITE(*,*) 'NO WIND DATA FOR TIME ', AT
ENDIF
ENDDO !K
!
! #######################################################################
ENDIF
ENDIF
!
! WIND AND/OR WATER QUALITY VARIABLES
! VARYING IN SPACE AND TIME
!
ELSEIF(FILES(ATMFILEB)%NAME(1:1).NE.' ') THEN
CALL METEO_FROM_BINARY_FILE(PATMOS,WINDX,WINDY,AT,NPOIN,VENT,
& ATMOS,ATMFILEB,FILES,LISTIN,
& WATER_QUALITY,PLUIE,OPTWIND,
& WIND_SPD)
ENDIF
ENDIF
!
!
!
RETURN
END
One last thing. Be aware of that this example takes wind comming direction as default for meteo stations. If your input is the propagation direction you have to invert U avd V vales.
Cheers
Victor