Ignore:
Timestamp:
Jul 21, 2021, 4:05:15 PM (3 years ago)
Author:
acozic
Message:

update in LMDZ-INCA-Dyn branche function get_var2 in dyn3dmem/dynetat0_loc.F90 to allow 3d variables in start.nc to have OR not a fourth dimension with the time axis. For this copy what it was done for get_var1 function.
Commit not done on the trunk - waiting for information to know how do it in dyn3d/ directory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ6/branches/LMDZ-INCA-Dyn/libf/dyn3dmem/dynetat0_loc.F90

    r3043 r3965  
    229229  CHARACTER(LEN=*), INTENT(IN)  :: var
    230230  REAL,             INTENT(OUT) :: v(:,:)
    231   REAL,             ALLOCATABLE :: w4(:,:,:,:)
     231  REAL,             ALLOCATABLE :: w4(:,:,:,:), w3(:,:,:)
    232232  INTEGER :: nn(4), dids(4), k, nd
     233
     234
    233235  CALL err(NF90_INQ_VARID(fID,var,vID),"inq",var)
    234   ierr=NF90_INQUIRE_VARIABLE(fID,vID,dimids=dids,ndims=nd)
     236  ierr=NF90_INQUIRE_VARIABLE(fID,vID,ndims=nd)
     237
     238  IF(nd==1) THEN
     239    CALL err(NF90_GET_VAR(fID,vID,v),"get",var); RETURN
     240  END IF
     241  ierr=NF90_INQUIRE_VARIABLE(fID,vID,dimids=dids)
     242
    235243  DO k=1,nd; ierr=NF90_INQUIRE_DIMENSION(fID,dids(k),len=nn(k)); END DO
    236   ALLOCATE(w4(nn(1),nn(2),nn(3),nn(4)))
    237   CALL err(NF90_GET_VAR(fID,vID,w4),"get",var)
    238   v=RESHAPE(w4,[nn(1)*nn(2),nn(3)]); DEALLOCATE(w4)
     244
     245  SELECT CASE(nd)
     246  CASE(3); ALLOCATE(w3(nn(1),nn(2),nn(3)))
     247     CALL err(NF90_GET_VAR(fID,vID,w3),"get",var)
     248     v=RESHAPE(w3,[nn(1)*nn(2),nn(3)]); DEALLOCATE(w3)
     249  CASE(4);  ALLOCATE(w4(nn(1),nn(2),nn(3),nn(4)))
     250     CALL err(NF90_GET_VAR(fID,vID,w4),"get",var)
     251     v=RESHAPE(w4,[nn(1)*nn(2),nn(3)]); DEALLOCATE(w4)
     252  END SELECT
    239253END SUBROUTINE get_var2
    240254
Note: See TracChangeset for help on using the changeset viewer.