From f388ed2f9199fd3b0d48a69af1ea08f3e8c23ba0 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 05:16:39 -0700 Subject: [PATCH 1/8] added spaces to improve readability --- src/gf_unpack3.F90 | 102 ++++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 52 deletions(-) diff --git a/src/gf_unpack3.F90 b/src/gf_unpack3.F90 index 4aa69819..8dbefaae 100644 --- a/src/gf_unpack3.F90 +++ b/src/gf_unpack3.F90 @@ -60,7 +60,7 @@ subroutine gf_unpack3(cgrib, lcgrib, iofst, igds, igdstmpl, & use re_alloc ! needed for subroutine realloc implicit none - character(len=1), intent(in) :: cgrib(lcgrib) + character(len = 1), intent(in) :: cgrib(lcgrib) integer, intent(in) :: lcgrib integer, intent(inout) :: iofst integer, pointer, dimension(:) :: igdstmpl, ideflist @@ -71,109 +71,107 @@ subroutine gf_unpack3(cgrib, lcgrib, iofst, igds, igdstmpl, & integer, intent(out) :: mapgridlen integer :: ibyttem logical needext - - !implicit none additions integer :: lensec, istat, i, nbits, isign, newmapgridlen, iret - ierr=0 + ierr = 0 nullify(igdstmpl, ideflist) call g2_gbytec(cgrib, lensec, iofst, 32) ! Get Length of Section - iofst=iofst+32 - iofst=iofst+8 ! skip section number + iofst = iofst + 32 + iofst = iofst + 8 ! skip section number call g2_gbytec(cgrib, igds(1), iofst, 8) ! Get source of Grid def. - iofst=iofst+8 + iofst = iofst + 8 call g2_gbytec(cgrib, igds(2), iofst, 32) ! Get number of grid pts. - iofst=iofst+32 + iofst = iofst + 32 call g2_gbytec(cgrib, igds(3), iofst, 8) ! Get num octets for opt. list - iofst=iofst+8 + iofst = iofst + 8 call g2_gbytec(cgrib, igds(4), iofst, 8) ! Get interpret. for opt. list - iofst=iofst+8 + iofst = iofst + 8 call g2_gbytec(cgrib, igds(5), iofst, 16) ! Get Grid Def Template num. - iofst=iofst+16 + iofst = iofst + 16 - if (igds(1).eq.0.OR.igds(1).eq.255) then ! FOR ECMWF TEST ONLY + if (igds(1) .eq. 0 .OR. igds(1) .eq. 255) then ! FOR ECMWF TEST ONLY allocate(mapgrid(lensec)) ! Get Grid Definition Template call getgridtemplate(igds(5), mapgridlen, mapgrid, needext, iret) - if (iret.ne.0) then - ierr=5 - if (allocated(mapgrid) ) deallocate(mapgrid) + if (iret .ne. 0) then + ierr = 5 + if (allocated(mapgrid)) deallocate(mapgrid) return endif else - mapgridlen=0 - needext=.false. + mapgridlen = 0 + needext = .false. endif ! Unpack each value into array igdstmpl from the the appropriate ! number of octets, which are specified in corresponding entries in ! array mapgrid. - istat=0 - if (mapgridlen.gt.0) allocate(igdstmpl(mapgridlen), stat=istat) - if (istat.ne.0) then - ierr=6 + istat = 0 + if (mapgridlen .gt. 0) allocate(igdstmpl(mapgridlen), stat = istat) + if (istat .ne. 0) then + ierr = 6 nullify(igdstmpl) - if (allocated(mapgrid) ) deallocate(mapgrid) + if (allocated(mapgrid)) deallocate(mapgrid) return endif - ibyttem=0 - do i=1, mapgridlen - nbits=iabs(mapgrid(i))*8 - if (mapgrid(i).ge.0 ) then + ibyttem = 0 + do i = 1, mapgridlen + nbits = iabs(mapgrid(i)) * 8 + if (mapgrid(i) .ge. 0) then call g2_gbytec(cgrib, igdstmpl(i), iofst, nbits) else call g2_gbytec(cgrib, isign, iofst, 1) - call g2_gbytec(cgrib, igdstmpl(i), iofst+1, nbits-1) - if (isign.eq.1) igdstmpl(i)=-igdstmpl(i) + call g2_gbytec(cgrib, igdstmpl(i), iofst + 1, nbits - 1) + if (isign .eq. 1) igdstmpl(i) = -igdstmpl(i) endif - iofst=iofst+nbits - ibyttem=ibyttem+iabs(mapgrid(i)) + iofst = iofst + nbits + ibyttem = ibyttem + iabs(mapgrid(i)) enddo ! Check to see if the Grid Definition Template needs to be extended. ! The number of values in a specific template may vary depending on ! data specified in the "static" part of the template. - if (needext ) then + if (needext) then call extgridtemplate(igds(5), igdstmpl, newmapgridlen, & mapgrid) - ! Unpack the rest of the Grid Definition Template + ! Unpack the rest of the Grid Definition Template. call realloc(igdstmpl, mapgridlen, newmapgridlen, istat) - do i=mapgridlen+1, newmapgridlen - nbits=iabs(mapgrid(i))*8 - if (mapgrid(i).ge.0 ) then + do i = mapgridlen + 1, newmapgridlen + nbits = iabs(mapgrid(i)) * 8 + if (mapgrid(i) .ge. 0) then call g2_gbytec(cgrib, igdstmpl(i), iofst, nbits) else call g2_gbytec(cgrib, isign, iofst, 1) - call g2_gbytec(cgrib, igdstmpl(i), iofst+1, nbits-1) - if (isign.eq.1) igdstmpl(i)=-igdstmpl(i) + call g2_gbytec(cgrib, igdstmpl(i), iofst + 1, nbits - 1) + if (isign.eq.1) igdstmpl(i) = -igdstmpl(i) endif - iofst=iofst+nbits - ibyttem=ibyttem+iabs(mapgrid(i)) + iofst = iofst + nbits + ibyttem = ibyttem + iabs(mapgrid(i)) enddo - mapgridlen=newmapgridlen + mapgridlen = newmapgridlen endif - if (allocated(mapgrid) ) deallocate(mapgrid) + if (allocated(mapgrid)) deallocate(mapgrid) - ! Unpack optional list of numbers defining number of points in each - ! row or column, if included. This is used for non regular grids. - if (igds(3).ne.0 ) then - nbits=igds(3)*8 - idefnum=(lensec-14-ibyttem)/igds(3) - istat=0 - if (idefnum.gt.0) allocate(ideflist(idefnum), stat=istat) - if (istat.ne.0) then - ierr=6 + ! Unpack optional list of numbers defining number of points in each + ! row or column, if included. This is used for non regular grids. + if (igds(3) .ne. 0) then + nbits = igds(3) * 8 + idefnum = (lensec - 14 - ibyttem) / igds(3) + istat = 0 + if (idefnum .gt. 0) allocate(ideflist(idefnum), stat = istat) + if (istat .ne. 0) then + ierr = 6 nullify(ideflist) return endif call g2_gbytesc(cgrib, ideflist, iofst, nbits, 0, idefnum) - iofst=iofst+(nbits*idefnum) + iofst = iofst + (nbits * idefnum) else - idefnum=0 + idefnum = 0 nullify(ideflist) endif end subroutine gf_unpack3 From 518f586daa3dc5b683a4dfa178425ba8e2088dc2 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 05:56:13 -0700 Subject: [PATCH 2/8] trying to fix macos CI --- .github/workflows/macOS.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 56021c66..97a0dbca 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -11,8 +11,8 @@ jobs: macOS-build: runs-on: macos-latest env: - FC: gfortran-9 - CC: gcc-9 + FC: gfortran-10 + CC: gcc-10 strategy: fail-fast: true From 30aa8f1aa637200e9abb503bbbf70af1f33e260d Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 05:58:51 -0700 Subject: [PATCH 3/8] trying to fix macos CI --- .github/workflows/macOS.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 97a0dbca..b2f5b711 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -11,8 +11,8 @@ jobs: macOS-build: runs-on: macos-latest env: - FC: gfortran-10 - CC: gcc-10 + FC: gfortran + CC: gcc strategy: fail-fast: true From b15a2209d27ec6406299dadc6636dd488a94ed3f Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 07:28:29 -0700 Subject: [PATCH 4/8] trying to fix macos CI --- .github/workflows/macOS.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index b2f5b711..c713d843 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -26,6 +26,7 @@ jobs: brew update brew install libpng brew install jpeg-turbo + brew install gfortran - name: checkout-bacio uses: actions/checkout@v2 From 78ebdcb28c2ad9b2903356e954e23cdd8b8a67bb Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 07:33:56 -0700 Subject: [PATCH 5/8] trying to fix macos CI --- .github/workflows/macOS.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index c713d843..aef1605f 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -26,7 +26,7 @@ jobs: brew update brew install libpng brew install jpeg-turbo - brew install gfortran + brew install gfortran-12 - name: checkout-bacio uses: actions/checkout@v2 From 3860642e0cb23c19dbcb6955a897e77274ffeaa1 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 07:34:17 -0700 Subject: [PATCH 6/8] trying to fix macos CI --- .github/workflows/macOS.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index aef1605f..c92b1170 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -11,7 +11,7 @@ jobs: macOS-build: runs-on: macos-latest env: - FC: gfortran + FC: gfortran-12 CC: gcc strategy: @@ -26,7 +26,7 @@ jobs: brew update brew install libpng brew install jpeg-turbo - brew install gfortran-12 + brew install gfortran - name: checkout-bacio uses: actions/checkout@v2 From 00739fa9afacedc7c13449339026b5da9db9eda3 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 07:38:32 -0700 Subject: [PATCH 7/8] trying to fix macos CI --- .github/workflows/macOS.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index c92b1170..7946cb85 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -26,7 +26,6 @@ jobs: brew update brew install libpng brew install jpeg-turbo - brew install gfortran - name: checkout-bacio uses: actions/checkout@v2 From 70bd2f37da5ced69fbe65c428f7ec07bd85532a5 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Tue, 8 Nov 2022 09:16:18 -0700 Subject: [PATCH 8/8] trying to fix macos CI --- .github/workflows/macOS.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macOS.yml b/.github/workflows/macOS.yml index 7946cb85..e0a24214 100644 --- a/.github/workflows/macOS.yml +++ b/.github/workflows/macOS.yml @@ -69,7 +69,7 @@ jobs: uses: actions/cache@v2 with: path: ~/Jasper - key: jasper-${{ runner.os }}-${{ hashFiles('jasper/VERSION') }} + key: jasper-${{ runner.os }}-${{ hashFiles('jasper/VERSION') }}-1 - name: build-jasper if: steps.cache-jasper.outputs.cache-hit != 'true' @@ -105,7 +105,7 @@ jobs: cd g2 mkdir build cd build - cmake -DCMAKE_PREFIX_PATH="~/Jasper;~/bacio;~/w3emc;~/g2c" .. + cmake -DCMAKE_PREFIX_PATH="~/Jasper;~/bacio;~/w3emc;~/g2c" -DCMAKE_BUILD_TYPE=Debug .. make -j2 - name: test