Subversion Repositories lagranto.icon

Rev

Rev 3 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 5
Line 214... Line 214...
214
         read(fid) tra
214
         read(fid) tra
215
 
215
 
216
c     Read IVE netcdf mode (mode=4)
216
c     Read IVE netcdf mode (mode=4)
217
      elseif (mode.eq.4) then
217
      elseif (mode.eq.4) then
218
 
218
 
219
         call input_getvars(fid,nvars,vars,ierr)
219
         call input_getvars(fid,vars,nvars,ierr)
220
 
220
 
221
         ierr = NF90_INQ_VARID(fid,'time',varid)
221
         ierr = NF90_INQ_VARID(fid,'time',varid)
222
         IF (ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
222
         IF (ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
223
         
223
         
224
         ierr = nf90_get_var(fid, varid, tra(1,:,1)  )
224
         ierr = nf90_get_var(fid, varid, tra(1,:,1)  )
Line 240... Line 240...
240
         enddo
240
         enddo
241
 
241
 
242
c     Read COSMO online netcdf mode (mode=5)
242
c     Read COSMO online netcdf mode (mode=5)
243
      elseif (mode.eq.5) then
243
      elseif (mode.eq.5) then
244
 
244
 
245
         call input_getvars(fid,nvars,vars,ierr)
245
         call input_getvars(fid,vars,nvars,ierr)
246
 
246
 
247
         ierr = NF90_INQ_VARID(fid,'time',varid)
247
         ierr = NF90_INQ_VARID(fid,'time',varid)
248
         IF (ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
248
         IF (ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
249
         
249
         
250
         ierr = nf90_get_var(fid, varid, tra(1,:,1)  )
250
         ierr = nf90_get_var(fid, varid, tra(1,:,1)  )
Line 358... Line 358...
358
      elseif (mode.eq.3) then
358
      elseif (mode.eq.3) then
359
         write(fid) tra                              
359
         write(fid) tra                              
360
 
360
 
361
c     Write netcdf mode (mode=4)
361
c     Write netcdf mode (mode=4)
362
      elseif (mode.eq.4) then
362
      elseif (mode.eq.4) then
363
 
363
      
364
         call input_getvars(fid,nvars,vars,ierr)
364
         call input_getvars(fid,vars,nvars,ierr)
365
 
365
 
366
         ierr = NF90_INQ_VARID(fid,'time',varid)
366
         ierr = NF90_INQ_VARID(fid,'time',varid)
367
         IF (ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
367
         IF (ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
368
         
368
         
369
         ierr = nf90_put_var(fid, varid, tra(1,:,1)  )
369
         ierr = nf90_put_var(fid, varid, tra(1,:,1)  )
Line 531... Line 531...
531
         ierr  = nf90_get_att(fid,nf90_global,"ref_min",   time(5) )
531
         ierr  = nf90_get_att(fid,nf90_global,"ref_min",   time(5) )
532
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
532
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
533
         ierr  = nf90_get_att(fid,nf90_global,"duration",  time(6) )
533
         ierr  = nf90_get_att(fid,nf90_global,"duration",  time(6) )
534
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
534
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
535
 
535
 
536
         call  input_getvars(fid,ncol,vars,ierr)
536
         call  input_getvars(fid,vars,nvars,ierr)
537
 
537
 
538
c     Read COSMO online netcdf mode (mode=5)
538
c     Read COSMO online netcdf mode (mode=5)
539
      elseif (mode.eq.5) then
539
      elseif (mode.eq.5) then
540
 
540
 
541
         ierr  = nf90_get_att(fid,nf90_global,"ref_year",  time(1) )
541
         ierr  = nf90_get_att(fid,nf90_global,"ref_year",  time(1) )
Line 549... Line 549...
549
         ierr  = nf90_get_att(fid,nf90_global,"ref_min",   time(5) )
549
         ierr  = nf90_get_att(fid,nf90_global,"ref_min",   time(5) )
550
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
550
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
551
         ierr  = nf90_get_att(fid,nf90_global,"duration",  time(6) )
551
         ierr  = nf90_get_att(fid,nf90_global,"duration",  time(6) )
552
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
552
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
553
 
553
 
554
         call  input_getvars(fid,ncol,vars,ierr)
554
         call  input_getvars(fid,vars,nvars,ierr)
555
 
555
 
556
         if ( vars(2).eq.'longitude' ) then
556
         if ( vars(2).eq.'longitude' ) then
557
            vars(2) = 'lon'
557
            vars(2) = 'lon'
558
         else
558
         else
559
            print*,' ERROR: lon missing on netCDF file'
559
            print*,' ERROR: lon missing on netCDF file'
Line 669... Line 669...
669
         write(fid) time
669
         write(fid) time
670
         write(fid) vars
670
         write(fid) vars
671
 
671
 
672
c     Write IVE netcdf format (mode=4)
672
c     Write IVE netcdf format (mode=4)
673
      elseif (mode.eq.4) then
673
      elseif (mode.eq.4) then
674
 
674
      
675
         ierr  = nf90_put_att(fid,nf90_global,"ref_year",  time(1) )
675
         ierr  = nf90_put_att(fid,nf90_global,"ref_year",  time(1) )
676
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
676
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
677
         ierr  = nf90_put_att(fid,nf90_global,"ref_month", time(2) )
677
         ierr  = nf90_put_att(fid,nf90_global,"ref_month", time(2) )
678
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
678
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
679
         ierr  = nf90_put_att(fid,nf90_global,"ref_day",   time(3) )
679
         ierr  = nf90_put_att(fid,nf90_global,"ref_day",   time(3) )
Line 691... Line 691...
691
 
691
 
692
         ierr=nf90_def_dim(fid,'ntra',ntra, dimids(1) )
692
         ierr=nf90_def_dim(fid,'ntra',ntra, dimids(1) )
693
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
693
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
694
         ierr=nf90_def_dim(fid,'ntim',ntim, dimids(2) )
694
         ierr=nf90_def_dim(fid,'ntim',ntim, dimids(2) )
695
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
695
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
696
         
696
 
697
         ierr = nf90_def_var(fid,'time',
697
         ierr = nf90_def_var(fid,'time',
698
     >                       NF90_FLOAT,dimids(2),varid)
698
     >                       NF90_FLOAT,dimids(2),varid)
699
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
699
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
700
         do i=2,ncol
700
         do i=2,ncol
701
            ierr = nf90_def_var(fid,vars(i),
701
            ierr = nf90_def_var(fid,vars(i),
Line 703... Line 703...
703
            IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
703
            IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
704
         enddo
704
         enddo
705
 
705
 
706
         ierr = nf90_enddef(fid)
706
         ierr = nf90_enddef(fid)
707
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
707
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
708
 
-
 
-
 
708
         print*,1
709
         call input_getvars(fid,nvars,vars_on_file,ierr)
709
         call input_getvars(fid,vars_on_file,nvars,ierr)
-
 
710
         print*,2,nvars
710
         if ( nvars.ne.ncol ) then
711
         if ( nvars.ne.ncol ) then
711
            print*,' ERROR: wrong number of fields on netCDF....'
712
            print*,' ERROR: wrong number of fields on netCDF....'
712
            stop
713
            stop
713
         endif
714
         endif
714
         do i=1,nvars
715
         do i=1,nvars
715
            if ( vars(i).ne.vars_on_file(i) ) then
716
            if ( vars(i).ne.vars_on_file(i) ) then
716
               print*,' ERROR: Field order wrong on netCDF...'
717
               print*,' ERROR: Field order wrong on netCDF...'
717
               stop
718
               stop
718
            endif
719
            endif
719
         enddo
720
         enddo
720
 
721
         
721
c     Write COSMO online netcdf format (mode=5)
722
c     Write COSMO online netcdf format (mode=5)
722
      elseif (mode.eq.5) then
723
      elseif (mode.eq.5) then
723
         print*," ERROR: writing online format not supported"
724
         print*," ERROR: writing online format not supported"
724
         stop
725
         stop
725
 
726
 
Line 936... Line 937...
936
      elseif (mode.eq.3) then
937
      elseif (mode.eq.3) then
937
         read(fid) ntra,ntim,ncol
938
         read(fid) ntra,ntim,ncol
938
 
939
 
939
      elseif (mode.eq.4) then
940
      elseif (mode.eq.4) then
940
              
941
              
941
         call input_getvars(fid,ncol,vars,ierr)
942
         call input_getvars(fid,vars,ncol,ierr)
942
 
943
 
943
         ierr = nf90_inq_dimid(fid,'ntra', ntraID)
944
         ierr = nf90_inq_dimid(fid,'ntra', ntraID)
944
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
945
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
945
         ierr = nf90_inquire_dimension(fid, ntraID, len = ntra)
946
         ierr = nf90_inquire_dimension(fid, ntraID, len = ntra)
946
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
947
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
Line 950... Line 951...
950
         ierr = nf90_inquire_dimension(fid, ntimID, len = ntim)
951
         ierr = nf90_inquire_dimension(fid, ntimID, len = ntim)
951
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
952
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
952
 
953
 
953
      elseif (mode.eq.5) then
954
      elseif (mode.eq.5) then
954
 
955
 
955
         call input_getvars(fid,ncol,vars,ierr)
956
         call input_getvars(fid,vars,ncol,ierr)
956
 
957
 
957
         ierr = nf90_inq_dimid(fid,'id', ntraID)
958
         ierr = nf90_inq_dimid(fid,'id', ntraID)
958
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
959
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
959
         ierr = nf90_inquire_dimension(fid, ntraID, len = ntra)
960
         ierr = nf90_inquire_dimension(fid, ntraID, len = ntra)
960
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)
961
         IF(ierr /= nf90_NoErr) PRINT *,NF90_STRERROR(ierr)