Changeset 860


Ignore:
Timestamp:
Jan 9, 2013, 5:49:56 PM (12 years ago)
Author:
tnavarro
Message:

Modification to create large files, that is to say with at least 2 variables > 2GiB. In that case, it is necessary to have an unlimited dimension.

Location:
trunk/LMDZ.MARS/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.MARS/util/hrecast.F90

    r410 r860  
    1414!     from 90 to -90 (again, you may omit the endpoints).
    1515! EM 09/2009
     16! TN 01/2013 : Adapted for large output files with at least 2 variables > 2 GiB
    1617
    1718implicit none
     
    9192logical :: out_has_poles ! Flag: true if output grid includes North and South
    9293                         ! poles
     94                         
     95integer, dimension(4) :: edges,corner ! needed to write variables for big files
     96
    9397!===============================================================================
    9498! 1. Input parameters
     
    537541
    538542! time
    539 ierr=NF_DEF_DIM(outfid,"Time",timelength,time_dimid)
     543ierr=NF_DEF_DIM(outfid,"Time",NF_UNLIMITED,time_dimid)
    540544if (ierr.ne.NF_NOERR) then
    541545  stop "Error: Could not define latitude dimension"
     
    858862
    859863! write time
    860 ierr=NF_PUT_VAR_REAL(outfid,time_varid,time)
     864ierr=NF_PUT_VARA_REAL(outfid,time_varid,1,timelength,time)
    861865if (ierr.ne.NF_NOERR) then
    862866  stop "Error: Could not write Time data to output file"
     
    944948    enddo
    945949    ! write interpolated data to output
    946     ierr=NF_PUT_VAR_REAL(outfid,var_id(i),out_3d_data)
     950    corner(:)=1
     951    edges(1)=lonlength
     952    edges(2)=latlength
     953    edges(3)=timelength
     954    ierr=NF_PUT_VARA_REAL(outfid,var_id(i),corner(1:3),edges(1:3),out_3d_data)
    947955    if (ierr.ne.NF_NOERR) then
    948956      write(*,*) "Error: Could not write ",trim(var(i))," data to output file"
     
    9951003    enddo
    9961004    ! write interpolated data to output
    997     ierr=NF_PUT_VAR_REAL(outfid,var_id(i),out_4d_data)
     1005    corner(:)=1
     1006    edges(1)=lonlength
     1007    edges(2)=latlength
     1008    edges(3)=altlength
     1009    edges(4)=timelength
     1010    ierr=NF_PUT_VARA_REAL(outfid,var_id(i),corner,edges,out_4d_data)
    9981011    if (ierr.ne.NF_NOERR) then
    9991012      write(*,*) "Error: Could not write ",trim(var(i))," data to output file"
  • trunk/LMDZ.MARS/util/zrecast.F90

    r829 r860  
    5959! EM 11/2012 : Adapted so it can be used on "generic" model outputs; planet
    6060!              constants (radius, R, etc.) are now read from file
     61! TN 01/2013 : Adapted for large output files with at least 2 variables > 2 GiB
     62!
    6163implicit none
    6264
     
    138140logical :: auto_mcd_levels ! Flag: specific case for MCD automatic above
    139141                           ! local surface levels
     142integer,dimension(4) :: edges,corner ! needed to write variables for big files
     143
    140144!===============================================================================
    141145! 1. Input parameters
     
    10191023
    10201024! time
    1021 ierr=NF_DEF_DIM(outfid,"Time",timelength,time_dimid)
     1025ierr=NF_DEF_DIM(outfid,"Time",NF_UNLIMITED,time_dimid)
    10221026if (ierr.ne.NF_NOERR) then
    10231027  write(*,*) "Error: Could not define Time dimension"
     
    15061510
    15071511! Write time
    1508 ierr=NF_PUT_VAR_REAL(outfid,time_varid,time)
     1512ierr=NF_PUT_VARA_REAL(outfid,time_varid,1,timelength,time)
    15091513if (ierr.ne.NF_NOERR) then
    15101514  write(*,*) "Error: Could not write Time data to output file"
     
    15181522
    15191523! Write surface pressure
    1520 
    1521 ierr=NF_PUT_VAR_REAL(outfid,ps_varid,ps)
     1524corner(:)=1
     1525edges(1)=lonlength
     1526edges(2)=latlength
     1527edges(3)=timelength
     1528ierr=NF_PUT_VARA_REAL(outfid,ps_varid,corner(1:3),edges(1:3),ps)
    15221529if (ierr.ne.NF_NOERR) then
    15231530  write(*,*) "Error: Could not write ps data to output file"
     
    15811588                      miss_val,ps,press,za_gcm,plevel,outdata)
    15821589  ! write result to output file
    1583   ierr=NF_PUT_VAR_REAL(outfid,za_varid,outdata)
     1590  corner(:)=1
     1591  edges(1)=lonlength
     1592  edges(2)=latlength
     1593  edges(3)=nblev
     1594  edges(4)=timelength
     1595  ierr=NF_PUT_VARA_REAL(outfid,var_id(i),corner,edges,outdata)
    15841596  if (ierr.ne.NF_NOERR) then
    15851597    write(*,*) "Error, Failed to write zareoid to output file"
Note: See TracChangeset for help on using the changeset viewer.