From 2c62158af8fa0594028725998ee3a081913c2039 Mon Sep 17 00:00:00 2001 From: Jim Bresch Date: Fri, 30 Mar 2012 23:09:02 +0000 Subject: [PATCH] Update the NCEP g2 library to 1.2.4 and the w3 library to 2.0.1. The changes are minor and shouldn't impact WPS functionality. git-svn-id: https://svn-wrf-wps.cgd.ucar.edu/trunk@655 86b71a92-4018-0410-97f8-d555beccfc3a --- ungrib/src/ngl/g2/CHANGES | 8 ++++++ ungrib/src/ngl/g2/dec_png.c | 2 +- ungrib/src/ngl/g2/enc_png.c | 2 +- ungrib/src/ngl/g2/getgb2s.f | 2 ++ ungrib/src/ngl/g2/gribmod.f | 2 +- ungrib/src/ngl/g2/params.f | 11 ++++++-- ungrib/src/ngl/g2/params_ecmwf.f | 6 +++- ungrib/src/ngl/g2/putgb2.f | 4 +-- ungrib/src/ngl/w3/CHANGES | 22 +++++++++++++++ ungrib/src/ngl/w3/w3fi63.f | 41 ++++++++++++++++++++++++---- ungrib/src/ngl/w3/w3fi71.f | 59 ++++++++++++++++++++++++++++++++++------ 11 files changed, 136 insertions(+), 23 deletions(-) diff --git a/ungrib/src/ngl/g2/CHANGES b/ungrib/src/ngl/g2/CHANGES index c045c2b..cf776d2 100755 --- a/ungrib/src/ngl/g2/CHANGES +++ b/ungrib/src/ngl/g2/CHANGES @@ -108,3 +108,11 @@ g2lib-1.2.1 - Aug 2010 - Added new local parameters conversion entries g2lib-1.2.2 - Dec 2010 - Added new local parameters conversion entries - Corrected Templates 4.42,4.43 + +g2lib-1.2.3 - Nov 2011 - Added new local parameters conversion entries + - Fixed bug in PUTGB2 that caused data fields to be + encoded incorrectly. + - Changed variable kprob(1) to kpds(5) in calling + routine param_g1_to_g2 + +g2lib-1.2.4 - Nov 2011 - Added 2 ECMWF parameters (TMAX/TMIN at 2m) conversion entries diff --git a/ungrib/src/ngl/g2/dec_png.c b/ungrib/src/ngl/g2/dec_png.c index 637fbe1..75dee08 100755 --- a/ungrib/src/ngl/g2/dec_png.c +++ b/ungrib/src/ngl/g2/dec_png.c @@ -100,7 +100,7 @@ int dec_png(unsigned char *pngbuf,g2int *width,g2int *height,char *cout) /* Set new custom read function */ - png_set_read_fn(png_ptr,(voidp)&read_io_ptr,(png_rw_ptr)user_read_data); + png_set_read_fn(png_ptr,(png_voidp)&read_io_ptr,(png_rw_ptr)user_read_data); /* png_init_io(png_ptr, fptr); */ /* Read and decode PNG stream */ diff --git a/ungrib/src/ngl/g2/enc_png.c b/ungrib/src/ngl/g2/enc_png.c index 8b80fd4..cb43f6c 100755 --- a/ungrib/src/ngl/g2/enc_png.c +++ b/ungrib/src/ngl/g2/enc_png.c @@ -99,7 +99,7 @@ int enc_png(char *data,g2int *width,g2int *height,g2int *nbits,char *pngbuf) /* Set new custom write functions */ - png_set_write_fn(png_ptr,(voidp)&write_io_ptr,(png_rw_ptr)user_write_data, + png_set_write_fn(png_ptr,(png_voidp)&write_io_ptr,(png_rw_ptr)user_write_data, (png_flush_ptr)user_flush_data); /* png_init_io(png_ptr, fptr); */ /* png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); */ diff --git a/ungrib/src/ngl/g2/getgb2s.f b/ungrib/src/ngl/g2/getgb2s.f index e129c51..b206afd 100755 --- a/ungrib/src/ngl/g2/getgb2s.f +++ b/ungrib/src/ngl/g2/getgb2s.f @@ -45,6 +45,7 @@ C C PROGRAM HISTORY LOG: C 95-10-31 IREDELL C 2002-01-02 GILBERT MODIFIED FROM GETG1S TO WORK WITH GRIB2 +C 2011-06-24 VUONG BOI Initialize variable gfld%idsect and gfld%local C C USAGE: CALL GETGB2S(CBUF,NLEN,NNUM,J,JDISC,JIDS,JPDTN,JPDT,JGDTN, C & JGDT,K,GFLD,LPOS,IRET) @@ -333,6 +334,7 @@ C INITIALIZE LPOS=0 IRET=1 IPOS=0 + nullify(gfld%idsect,gfld%local) nullify(gfld%list_opt,gfld%igdtmpl,gfld%ipdtmpl) nullify(gfld%coord_list,gfld%idrtmpl,gfld%bmap,gfld%fld) C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ungrib/src/ngl/g2/gribmod.f b/ungrib/src/ngl/g2/gribmod.f index c081ebf..dc3d5bd 100755 --- a/ungrib/src/ngl/g2/gribmod.f +++ b/ungrib/src/ngl/g2/gribmod.f @@ -165,7 +165,7 @@ ! !$$$ - character(len=12) :: G2_VERSION="g2lib-1.2.2" + character(len=12) :: G2_VERSION="g2lib-1.2.4" type gribfield integer :: version,discipline diff --git a/ungrib/src/ngl/g2/params.f b/ungrib/src/ngl/g2/params.f index f46b638..df6d7b3 100755 --- a/ungrib/src/ngl/g2/params.f +++ b/ungrib/src/ngl/g2/params.f @@ -22,6 +22,8 @@ ! 2009-12-14 Vuong - Correction VEGT(4.2-0-210) ! 2010-07-27 Vuong - Added more parameters ! 2010-12-06 Vuong - Added more parameters +! 2011-05-24 Vuong - Added more parameters +! 2011-09-12 Vuong - Added more parameters ! ! USAGE: use params ! @@ -31,7 +33,7 @@ ! !$$$ - integer,parameter :: MAXPARAM=750 + integer,parameter :: MAXPARAM=755 type gribparam integer :: g1tblver @@ -802,7 +804,12 @@ data paramlist(747) /gribparam(129,253,0,2,222,'MAXUW')/ data paramlist(748) /gribparam(129,254,0,2,223,'MAXVW')/ data paramlist(749) /gribparam(129,241,0,2,224,'VRATE')/ - data paramlist(750) /gribparam(129,250,0,4,4,'HINDEX')/ + data paramlist(750) /gribparam(129,250,2,4,3,'HINDEX')/ + data paramlist(751) /gribparam(129,175,0,19,234,'ICSEV')/ + data paramlist(752) /gribparam(129,176,0,19,233,'ICPRB')/ + data paramlist(753) /gribparam(2,236,0,19,217,'SIPD')/ + data paramlist(754) /gribparam(129,230,0,19,242,'RHPW')/ + data paramlist(755) /gribparam(130,206,0,15,3,'VIL')/ contains diff --git a/ungrib/src/ngl/g2/params_ecmwf.f b/ungrib/src/ngl/g2/params_ecmwf.f index 3b6a63c..916b03b 100755 --- a/ungrib/src/ngl/g2/params_ecmwf.f +++ b/ungrib/src/ngl/g2/params_ecmwf.f @@ -11,6 +11,7 @@ ! 2006-09-07 Gordon - Modified from Steve Gilbert's params.f for NCEP GRIB data ! 2007-04-20 Vuong - Add more parameters ! 2007-10-11 Vuong - Add more parameters +! 2011-11-16 Vuong - Add parameters MAX and MIN temperature ! ! USAGE: use params ! @@ -20,7 +21,7 @@ ! !$$$ - integer,parameter :: MAXPARAM=177 + integer,parameter :: MAXPARAM=179 type gribparam integer :: g1tblver @@ -212,6 +213,9 @@ data paramlist(175) /gribparam(1,11,0,0,0,'TMP ')/ data paramlist(176) /gribparam(1,52,0,1,1,'R H ')/ data paramlist(177) /gribparam(1,41,0,2,10,'ABS V ')/ +! Added 11/16/2011- Add more parameters + data paramlist(178) /gribparam(128,121,0,0,4,'TMXK ')/ + data paramlist(179) /gribparam(128,122,0,0,5,'TMNK ')/ contains diff --git a/ungrib/src/ngl/g2/putgb2.f b/ungrib/src/ngl/g2/putgb2.f index a7711a7..6935b9d 100755 --- a/ungrib/src/ngl/g2/putgb2.f +++ b/ungrib/src/ngl/g2/putgb2.f @@ -22,6 +22,7 @@ C 2002-04-22 GILBERT C 2005-02-28 GILBERT - Changed dimension of array cgrib to be a multiple C of gfld%ngrdpts instead of gfld%ndpts. C 2009-03-10 VUONG - Initialize variable coordlist +C 2011-06-09 VUONG - Initialize variable gfld%list_opt C C USAGE: CALL PUTGB2(LUGB,GFLD,IRET) C INPUT ARGUMENTS: @@ -196,7 +197,6 @@ C$$$ integer :: listsec0(2)=(/0,2/) integer :: igds(5)=(/0,0,0,0,0/) real :: coordlist=0.0 - integer :: ilistopt=0 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - C ALLOCATE ARRAY FOR GRIB2 FIELD @@ -238,7 +238,7 @@ C ADD GRID TO GRIB2 MESSAGE igds(5)=gfld%igdtnum if ( associated(gfld%igdtmpl) ) then call addgrid(cgrib,lcgrib,igds,gfld%igdtmpl,gfld%igdtlen, - & ilistopt,gfld%num_opt,ierr) + & gfld%list_opt,gfld%num_opt,ierr) if (ierr.ne.0) then write(6,*) 'putgb2: ERROR adding grid info = ',ierr endif diff --git a/ungrib/src/ngl/w3/CHANGES b/ungrib/src/ngl/w3/CHANGES index f2d8972..4df1a66 100755 --- a/ungrib/src/ngl/w3/CHANGES +++ b/ungrib/src/ngl/w3/CHANGES @@ -16,3 +16,25 @@ w3lib-1.5 - NOV 2007 - Update routines (w3fi71.f and w3fi63.f) to add w3lib-1.6 - JAN 2008 - Update routines (w3fi71.f and w3fi63.f) to add new grids 195 and Changed grid 196 (from Arakawa-E to Mercator) + +w3lib-1.7 - JUN 2009 - Update routines (w3fi63.f) to handle grid 45 + +w3lib-1.8 - JAN 2010 - Update routines (w3fi71.f and w3fi63.f) to add + new grids 139 and 140 + +w3lib-1.9 - AUG 2010 - added new grid 184, 199, 83 and + redefined grid 90 for new rtma conus 1.27-km + redefined grid 91 for new rtma alaska 2.976-km + redefined grid 92 for new rtma alaska 1.488-km + +w3lib-2.0 - Jan 2011 - CHANGED GRID 94 TO ALASKA 6KM STAGGERED B-GRID + CHANGED GRID 95 TO PUERTO RICO 3KM STAGGERED B-GRID + CHANGED GRID 96 TO HAWAII 3KM STAGGERED B-GRID + CHANGED GRID 96 TO HAWAII 3KM STAGGERED B-GRID + CHANGED GRID 97 TO CONUS 4KM STAGGERED B-GRID + CHANGED GRID 99 TO NAM 12KM STAGGERED B-GRID + ADDED GRID 179 (12 KM POLAR STEREOGRAPHIC OVER NORTH AMERICA) + CHANGED GRID 194 TO 3KM MERCATOR GRID OVER PUERTO RICO + CORRECTED LATITUDE OF SW CORNER POINT OF GRID 151 + FIX ALLOCATION OF ARRAY BMS + ADD GRID 205 - ROTATED LAT/LON A,B,C,D STAGGERS diff --git a/ungrib/src/ngl/w3/w3fi63.f b/ungrib/src/ngl/w3/w3fi63.f index 94a8136..5b4f3b5 100755 --- a/ungrib/src/ngl/w3/w3fi63.f +++ b/ungrib/src/ngl/w3/w3fi63.f @@ -146,6 +146,7 @@ C CHANGED GRID 99 TO NAM 12KM STAGGERED B-GRID C ADDED GRID 179 (12 KM POLAR STEREOGRAPHIC OVER NORTH AMERICA) C CHANGED GRID 194 TO 3KM MERCATOR GRID OVER PUERTO RICO C CORRECTED LATITUDE OF SW CORNER POINT OF GRID 151 +C 2011-10-12 VUONG ADDED GRID 129, 187, 188, 189 AND 193 C C USAGE: CALL W3FI63(MSGA,KPDS,KGDS,KBMS,DATA,KPTR,KRET) C INPUT ARGUMENT LIST: @@ -2351,6 +2352,10 @@ C ----- U.S. GRID 127 - MAP SIZE 294912 C ----- U.S. GRID 128 - MAP SIZE 663552 J = 663552 GO TO 800 + ELSE IF (KPDS(3).EQ.129) THEN +C ----- U.S. GRID 129 - MAP SIZE 1548800 + J = 1548800 + GO TO 800 ELSE IF (KPDS(3).EQ.130) THEN C ----- U.S. GRID 130 - MAP SIZE 151987 J = 151987 @@ -2456,10 +2461,26 @@ C ----- U.S. GRID 183 - MAP SIZE 180144 C ----- U.S. GRID 184 - MAP SIZE 2953665 J = 2953665 GO TO 800 + ELSE IF (KPDS(3).EQ.187) THEN +C ----- U.S. GRID 187 - MAP SIZE 3425565 + J = 3425565 + GO TO 800 + ELSE IF (KPDS(3).EQ.188) THEN +C ----- U.S. GRID 188 - MAP SIZE 563655 + J = 563655 + GO TO 800 + ELSE IF (KPDS(3).EQ.189) THEN +C ----- U.S. GRID 189 - MAP SIZE 560025 + J = 560025 + GO TO 800 ELSE IF (KPDS(3).EQ.190) THEN C ----- U.S GRID 190 - MAP SIZE 796590 J = 796590 GO TO 800 + ELSE IF (KPDS(3).EQ.193) THEN +C ----- U.S GRID 193 - MAP SIZE 1038240 + J = 1038240 + GO TO 800 ELSE IF (KPDS(3).EQ.192) THEN C ----- U.S GRID 192 - MAP SIZE 91719 J = 91719 @@ -3948,11 +3969,7 @@ C --------------------------------------- IF (I.NE.J) THEN RETURN END IF - ELSE IF (KPDS(3).GE.122.AND.KPDS(3).LE.128) THEN - IF (I.NE.J) THEN - RETURN - END IF - ELSE IF (KPDS(3).EQ.130) THEN + ELSE IF (KPDS(3).GE.122.AND.KPDS(3).LE.130) THEN IF (I.NE.J) THEN RETURN END IF @@ -3992,11 +4009,23 @@ C --------------------------------------- IF (I.NE.J) THEN RETURN END IF + ELSE IF (KPDS(3).EQ.187) THEN + IF (I.NE.J) THEN + RETURN + END IF + ELSE IF (KPDS(3).EQ.188) THEN + IF (I.NE.J) THEN + RETURN + END IF + ELSE IF (KPDS(3).EQ.189) THEN + IF (I.NE.J) THEN + RETURN + END IF ELSE IF (KPDS(3).EQ.190.OR.KPDS(3).EQ.192) THEN IF (I.NE.J) THEN RETURN END IF - ELSE IF (KPDS(3).GE.194.AND.KPDS(3).LE.199) THEN + ELSE IF (KPDS(3).GE.193.AND.KPDS(3).LE.199) THEN IF (I.NE.J) THEN RETURN END IF diff --git a/ungrib/src/ngl/w3/w3fi71.f b/ungrib/src/ngl/w3/w3fi71.f index 5ff26d4..45f9c9f 100755 --- a/ungrib/src/ngl/w3/w3fi71.f +++ b/ungrib/src/ngl/w3/w3fi71.f @@ -98,15 +98,16 @@ C 2010-08-05 VUONG ADDED NEW GRID 184, 199, 83 AND C REDEFINED GRID 90 FOR NEW RTMA CONUS 1.27-KM C REDEFINED GRID 91 FOR NEW RTMA ALASKA 2.976-KM C REDEFINED GRID 92 FOR NEW RTMA ALASKA 1.488-KM -C 2010-09-08 ROGERS CHANGED GRID 94 TO ALASKA 6KM STAGGERED B-GRID -C CHANGED GRID 95 TO PUERTO RICO 3KM STAGGERED B-GRID -C CHANGED GRID 96 TO HAWAII 3KM STAGGERED B-GRID -C CHANGED GRID 96 TO HAWAII 3KM STAGGERED B-GRID -C CHANGED GRID 97 TO CONUS 4KM STAGGERED B-GRID -C CHANGED GRID 99 TO NAM 12KM STAGGERED B-GRID -C ADDED GRID 179 (12 KM POLAR STEREOGRAPHIC OVER NORTH AMERICA) -C CHANGED GRID 194 TO 3KM MERCATOR GRID OVER PUERTO RICO -C CORRECTED LATITUDE OF SW CORNER POINT OF GRID 151 +C 2010-09-08 ROGERS CHANGED GRID 94 TO ALASKA 6KM STAGGERED B-GRID +C CHANGED GRID 95 TO PUERTO RICO 3KM STAGGERED B-GRID +C CHANGED GRID 96 TO HAWAII 3KM STAGGERED B-GRID +C CHANGED GRID 96 TO HAWAII 3KM STAGGERED B-GRID +C CHANGED GRID 97 TO CONUS 4KM STAGGERED B-GRID +C CHANGED GRID 99 TO NAM 12KM STAGGERED B-GRID +C ADDED GRID 179 (12 KM POLAR STEREOGRAPHIC OVER NORTH AMERICA) +C CHANGED GRID 194 TO 3KM MERCATOR GRID OVER PUERTO RICO +C CORRECTED LATITUDE OF SW CORNER POINT OF GRID 151 +C 2011-10-12 VUONG ADDED GRID 129, 187, 188, 189 and 193 C C USAGE: CALL W3FI71 (IGRID, IGDS, IERR) C INPUT ARGUMENT LIST: @@ -372,6 +373,7 @@ C INTEGER GRD126(18) INTEGER GRD127(18) INTEGER GRD128(18) + INTEGER GRD129(18) INTEGER GRD130(18) INTEGER GRD138(18) INTEGER GRD139(18) @@ -398,8 +400,12 @@ C INTEGER GRD182(18) INTEGER GRD183(18) INTEGER GRD184(18) + INTEGER GRD187(18) + INTEGER GRD188(18) + INTEGER GRD189(18) INTEGER GRD190(18) INTEGER GRD192(18) + INTEGER GRD193(18) INTEGER GRD194(18) INTEGER GRD195(18) INTEGER GRD196(18) @@ -683,6 +689,8 @@ C & -469, 192, 469, 0, 0, 0, 0, 0, 0/ DATA GRD128/ 0, 255, 4,1152,576, 89761, 0, 128, -89761, & -313, 288, 313, 0, 0, 0, 0, 0, 0/ + DATA GRD129/ 0, 255, 4,1760,880, 89844, 0, 128, -89844, + & -205, 440, 205, 0, 0, 0, 0, 0, 0/ DATA GRD130/ 0, 255, 3, 451,337, 16281, -126138, 8, -95000, & 13545, 13545, 0, 64, 0, 25000, 25000, 0, 0/ DATA GRD138/ 0, 255, 3, 468,288, 21017, -123282, 8, -97000, @@ -735,10 +743,18 @@ C & -130124, 108, 108, 0, 0, 0, 0, 0, 0/ DATA GRD184/ 0, 255, 3,2145,1377, 20192, -121554, 8, -95000, & 2540, 2540, 0, 64, 0, 25000, 25000, 0, 0/ + DATA GRD187/ 0, 255, 3,2145,1597, 20192, -121554, 8, -95000, + & 2540, 2540, 0, 64, 0, 25000, 25000, 0, 0/ + DATA GRD188/ 0, 255, 3, 709, 795, 37979, -125958, 8, -95000, + & 2540, 2540, 0, 64, 0, 25000, 25000, 0, 0/ + DATA GRD189/ 0, 255, 5, 655, 855, 51500, -142500, 8, -135000, + & 1448, 1448, 0, 64, 0, 0, 0, 0, 0/ DATA GRD190/ 0, 255,205,954,835, -7491, -144134, 136, 54000, & -106000, 126, 108, 64, 44540, 14802, 0, 0, 0/ DATA GRD192/ 0, 255,203,237,387, -3441, -148799, 136, 50000, & -111000, 225,207,64, 0, 0, 0, 0, 0/ + DATA GRD193 / 0, 255, 0, 1440, 721, 90000, 0, 128, -90000, + & -250, 250, 250, 0, 0, 0, 0, 0, 0/ DATA GRD194/ 0, 255, 1, 544,310, 15000, -75500, 128, 22005, & -62509, 2500, 2500, 20000, 64, 0, 0, 0, 0/ DATA GRD195/ 0, 255, 1, 177,129, 16829, -68196, 128, 19747, @@ -1265,6 +1281,11 @@ C IGDS(I) = GRD128(I) ENDDO C + ELSE IF (IGRID.EQ.129) THEN + DO I = 1,18 + IGDS(I) = GRD129(I) + ENDDO +C ELSE IF (IGRID.EQ.130) THEN DO I = 1,18 IGDS(I) = GRD130(I) @@ -1394,6 +1415,21 @@ C IGDS(I) = GRD184(I) ENDDO C + ELSE IF (IGRID.EQ.187) THEN + DO I = 1,18 + IGDS(I) = GRD187(I) + ENDDO +C + ELSE IF (IGRID.EQ.188) THEN + DO I = 1,18 + IGDS(I) = GRD188(I) + ENDDO +C + ELSE IF (IGRID.EQ.189) THEN + DO I = 1,18 + IGDS(I) = GRD189(I) + ENDDO +C ELSE IF (IGRID.EQ.190) THEN DO 2190 I = 1,18 IGDS(I) = GRD190(I) @@ -1404,6 +1440,11 @@ C IGDS(I) = GRD192(I) 2191 CONTINUE C + ELSE IF (IGRID.EQ.193) THEN + DO I = 1,18 + IGDS(I) = GRD193(I) + END DO +C ELSE IF (IGRID.EQ.194) THEN DO 2192 I = 1,18 IGDS(I) = GRD194(I) -- 2.11.4.GIT