Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

    else

        % *** write only specific cells (NLA <= NL)

%        fwrite(fo,NLA,'uint32');

%         for n=1:NLA,

%             fwrite(fo,cell(n).L,'uint32');

%             fwrite(fo,cell(n).I,'uint32');

%             fwrite(fo,cell(n).J,'uint32');

%             for j=1:NC,

%                 for k=1:NK,

%                     fwrite(fo,values(k,n,j,i),'float32');

%                 end;

%             end;

%         end;

    end;

end;

fclose(fo);

Python code

import numpy as np

from array import array

INPT = 0            # Input format (0 = all cells)

NT = 3              # Number of time steps

NC = 1              # Number of components (e.g., 2 for wind-X, wind-Y)

NL = 29632          # Number of cells (active cell count = LA - 1 = LC - 2)

NK = 1              # Number of layers

ITRP = 1            # Interpolation between time steps (0 = No, 1 = Linear)

IUPD = 0            # Update option (0 = replace, 1 = add, 2 = min, 3 = max)

IDST = 1            # Distribution option (0 = flux, 1 = multiplied by cell area)

NODAT = -999        # No data. Ignore updating for cells with this value

TSCL = 86400        # Time conversion factor to seconds (default 86400)

TSHF = 0            # Time shift, same unit as time values (default 0)

VSCL = 1            # Value conversion factor (default 1)

VSHF = 0            # Value offset, same unit as field values (default 0)

YY=2005             # Base date's year

MM=9                # Base date's month

DD=30               # Base date's day

# Test data

times = [1, 2, 3]

values = np.zeros(NC*NL*NK)

fileName = 'evapfld.fld'

# Write binary format

fo = open(fileName, 'wb')

signature = bytearray([70, 76, 68, 49])

intVal = 0  % Reserved

fo.write(signature)

fo.write(np.uint32(INPT))

fo.write(np.uint32(NT))

fo.write(np.uint32(NC))

fo.write(np.uint32(NL))

fo.write(np.uint32(NK))

fo.write(np.uint32(ITRP))

fo.write(np.uint32(IUPD))

fo.write(np.uint32(IDST))

fo.write(np.float32(NODAT))

fo.write(np.float32(TSCL))

fo.write(np.float32(TSHF))

fo.write(np.float32(VSCL))

fo.write(np.float32(VSHF))

fo.write(np.uint32(YY))

fo.write(np.uint32(MM))

fo.write(np.uint32(DD))

fo.write(np.uint32(intVal))

fo.write(np.uint32(intVal))

fo.write(np.uint32(intVal))

for t in range(0,NT):

       fo.write(np.float64(times[t]))

       fo.write(np.uint32(NL))

       #for n in range(0,NC):

       #      for i in range(0,NL):

       #            for k in range(0,NK):

       #                   fo.write(np.float32(values[n,i,k]))

       fo.write(np.float32(values))

fo.close()

C# code

public void WriteFileBinary(string workPath, string fileName)

{

    int Signature = 0x31444C46, intVal = 0;

    fileName = Path.ChangeExtension(fileName, ".fld");

    string filePath = Path.Combine(workPath, fileName.ToLower());

    using (BinaryWriter fo = new BinaryWriter(File.Open(filePath, FileMode.Create)))

    {

        fo.Write(Signature);

        fo.Write(INPT);

        fo.Write(NT);

        fo.Write(NC);

        fo.Write(NL);

        fo.Write(NK);

        fo.Write(ITRP);

        fo.Write(IUPD);

        fo.Write(IDST);

        fo.Write(NODAT);

        fo.Write(TSCL);

        fo.Write(TSHF);

        fo.Write(VSCL);

        fo.Write(VSHF);

        fo.Write((int)BaseDate.Year);

        fo.Write((int)BaseDate.Month);

        fo.Write((int)BaseDate.Day);

        fo.Write((int)intVal);

        fo.Write((int)intVal);

        fo.Write((int)intVal);

        for (int i = 0; i < NT; i++)

        {

            fo.Write(Times[i]);

            if (INPT == 0)

            {

                fo.Write(NL);

                for (int n = 0; n < NC; n++)

                {

                    for (int j = 0; j < NL; j++)

                    {

                        for (int k = 0; k < NK; k++)

                        {

                            fo.Write(Values[i][n][j][k]);

                        }

                    }

                }

            }

            else

            {

                int cellCnt = 0;

                for (int j = 0; j < NL; j++)

                {

                    bool hasValue = false;

                    for (int n = 0; n < NC; n++)

                    {

                        for (int k = 0; k < NK; k++)

                        {

                            if (!float.IsNaN(Values[i][n][j][k]) &&
                                 Values[i][n][j][k] != NODAT)

                            {

                                hasValue = true;

                                break;

                            }

                        }

                        if (hasValue) { break; }

                    }

                    if (hasValue) { cellCnt++; }

                }

                fo.Write(cellCnt);

                for (int j = 0; j < NL; j++)

                {

                    Cell cell = Model.Grid.Cells[j];

                    fo.Write(cell.ID);

                    fo.Write(cell.Col);

                    fo.Write(cell.Row);

                    for (int n = 0; n < NC; n++)

                    {

                        for (int k = 0; k < NK; k++)

                        {

                            fo.Write(!float.IsNaN(Values[i][n][j][k]) ?
                               Values[i][n][j][k] : NODAT);

                        }

                    }

                }

            }

        }

        fo.Flush();

    }

...

Data Format B-16  ISTAT.INP for ISICE = 2
C ** ISTAT FILE
C ** TIME SERIES ON THE STATUS OF ICE ON/OFF VIA ICE COVER
C ** FIRST DATA LINE: MISER(N),TCISER(N),TAISER(N),N=1(only one)
C ** NEXT DATA LINES: TISER(M,N),RICECOVS(M,N), M=1:MISER
C ** TISER: TIME, RICECOVS = 1: ON/0:OFF
5     86400     0
0.000     0.0000
240.000 1.0000
242.000 0.0000
243.000 1.0000
300.000 0.0000Data Format B-18  ICE.INP for ISICE = 3 & 4

 * ICE THICKNESS INITIAL CONDITIONS

...

Data Format B-21  SEDZLJ Input Files: BED.SDF

# VAR_BED Bedload  Nequil LAYMAX  ISEDTIME  IMORPH IFWAVE MAXDEPLIM#

     1                    1            0             7               1                 0               0             1.0

# ITBM NSICM  Array Parameters #

    8     8

# ZBSKIN (>0 sets Zo in [um]) TAUCONST [dynes/cm^2] (> 0 to set constant)  ISSLOPE #

    10.0  0.0   0

# D50 of Size Class D50(K) [um] #

 10.0  22.0  222.0  375.0  750.0  4000.0  22.0  222.0

 # Critical Shear for Erosion TAUCRS(K) [dynes/cm^2] #

 1.0   2.2   1.6    2.4    3.8    30.8    2.2   1.6

# Critical Shear for Suspension TCRDPS(K) [dynes/cm^2] #

 1.0   2.2   2.4    3.5    12.5   98.8    2.2   2.4

# Sediment Bed Size (um) Tables #

 2.0  222.0  432.0  1020.0  2400.0  2600.0  3360.0  6000.0  8520.0

# Critical Shear for Erosion of Bed Surface [dynes/cm^2]  #

 0.50  2.27   2.96    4.17    5.88    6.07    6.72    8.48    9.75

#  Erosion rates for active and deposited Layers [cm/s] #

 1.00E-09 5.97E-05 5.97E-04 5.96E-03 5.95E-02 5.94E-01 5.94E+00 5.93E+01 !    2 Micron

 1.00E-09 5.97E-05 5.97E-04 5.96E-03 5.95E-02 5.94E-01 5.94E+00 5.93E+01 !  222 Micron

 1.00E-09 3.65E-04 2.16E-03 1.27E-02 7.49E-02 4.42E-01 2.61E+00 1.54E+01 !  432 Micron

 1.00E-09 2.01E-04 1.14E-03 6.51E-03 3.71E-02 2.11E-01 1.20E+00 6.85E+00 ! 1020 Micron

 1.00E-09 1.12E-05 8.40E-05 6.28E-04 4.70E-03 3.51E-02 2.63E-01 1.96E+00 ! 2400 Micron

 1.00E-09 7.94E-06 6.01E-05 4.55E-04 3.45E-03 2.61E-02 1.98E-01 1.50E+00 ! 2600 Micron

 1.00E-09 2.11E-06 1.67E-05 1.31E-04 1.04E-03 8.17E-03 6.44E-02 5.08E-01 ! 3360 Micron

 1.00E-09 2.03E-08 1.67E-07 1.44E-06 1.24E-05 1.07E-04 9.28E-04 8.02E-03 ! 6000 Micron

1.00E-09 1.19E-09 2.75E-09 1.69E-08 1.47E-07 1.33E-06 1.22E-05 1.11E-04 ! 8250 micron

Data Format B-22  SEDZLJ Input Files: ERATE.SDF

#  Layer Thicknesses                  #

  0.00  0.00  15.00  15.00  15.00         15.00  15.00

 # Active layer thickness multiplier

 2.0

#  Core 1 - Riverine Sediments - Critical Shear Stress (dynes/cm^2)  #

 3.0  3.0  3.0  3.5  4.0  5.0  999.0

#  Bulk Density (g/cm^3)               #

 1.35 1.40 1.45 1.50 1.55 1.60 1.60

 # Water and sediment density (g/cm^3)  #

 1.0 2.65

#  Particle Size Distribution          #

  13. 57. 24. 5. 1. 0. 0. 0.

  13. 57. 24. 5. 1. 0. 0. 0.

  13. 57. 24. 5. 1. 0. 0. 0.

  13. 57. 24. 5. 1. 0. 0. 0.

  13. 57. 24. 5. 1. 0. 0. 0.

  13. 57. 24. 5. 1. 0. 0. 0.

  13. 57. 24. 5. 1. 0. 0. 0.

#  Initial Bed Erosion Rates           #

         0.0

 1.000E-09 1.000E-09 1.000E-09 1.000E-09 1.000E-09 1.000E-09 1.000E-09 1.000E-09 1.000E-09 1.000E-09

          2.0

 2.460E-09 2.460E-09 2.460E-09 1.706E-04 8.020E-05 2.260E-05 3.700E-09 3.700E-09 3.700E-09 3.700E-09

         4.0

 1.460E-03 1.460E-03 1.460E-03 5.790E-04 2.120E-04 7.980E-05 7.660E-08 7.660E-08 7.660E-08 7.660E-08

          8.0

 8.680E-03 8.680E-03 8.680E-03 1.910E-03 5.580E-04 2.820E-04 1.580E-06 1.580E-06 1.580E-06 1.580E-06

         16.0

 5.150E-02 5.150E-02 5.150E-02 6.280E-03 1.470E-03 9.950E-04 3.280E-05 3.280E-05 3.280E-05 3.280E-05

        32.0

 3.060E-01 3.060E-01 3.060E-01 2.070E-02 3.890E-03 3.510E-03 6.770E-04 6.770E-04 6.770E-04 6.770E-04

        64.0

 1.820E+00 1.820E+00 1.820E+00 6.820E-02 1.030E-02 1.240E-02 1.400E-02 1.400E-02 1.400E-02 1.400E-02

       128.0

1.080E+01 1.080E+01 1.080E+01 2.250E-01 2.710E-02 4.380E-02 2.900E-01 2.900E-01 2.900E-01 2.900E-01

Data Format B-23  SEDZLJ Input Files: ENSIGHT.SDF

#

C Input file for Ensight output

C values of 1 turns on the variable and 0 turns off the variable    

C          1   U  - X velocity

C          2   V  - Y velocity

C          3  TAU - Shear Stress on active layer

C          4  D50 - Averaged particle size

C          5  CBL - Bedload concentration

C          6  SED - Suspended sediment concentration

C       7  CHC - cyanobacteria

C       8  CHG - diatom algae

C       9  CHD - green algae

C       10  ROC - refractory particulate organic carbon

C       11  LOC - labile particulate organic carbon

C       12  DOC - dissolved organic carbon

C       13  ROP - refractory particulate organic phosphorus

C       14  LOP - labile particulate organic phosphorus

C       15  DOP - dissolved organic phosphorus

C       16  P4D - total phosphate

C       17  RON - refractory particulate organic nitrogen

C       18  LON - labile particulate organic nitrogen

C       19  DON - dissolved organic nitrogen

C       20  NHX - ammonia nitrogen

C       21  NOX - nitrate nitrogen

C       22  SUU - particulate biogenic silica

C       23  SAA - dissolved available silica

C       24  COD - chemical oxygen demand

C       25  DOX - dissolved oxygen

C       26  TAM - total active metal

C       27  FCB - fecal coliform bacteria

C       28  CO2 - Dissolved Carbon Dioxide

C       29  MAC - macroalgae

C       30  HEAT- Heat Content

C          31  TEMP- Temperature (K)

C  U     V   TAU  D50  CBL  SED 

C  CHC  CHD  CHG  ROC  LOC  DOC  ROP  LOP  DOP  P4D  RON   LON  DON

C  NHX  NOX  SUU  SAA  COD  DOX  TAM  FCB  CO2  MAC  HEAT  TEMP

   1     1    1    1    1    1

   0     0    0    0    0    0    0    0    0    0    0     0    0

   0     0    0    0    0    0    0    0    0    0    0     0

Data Format B-24  SEDZLJ Input Files: CORE_FIELD.SDF

     9        !    Number of Sedflume cores 

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 8 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

0 0 8 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Data Format B-25  Atmospheric Forcing Files: ASER.INP

C  aser.inp file, in free format across line, repeats naser=1 times, lake okeechobee                                                                                                

C                                                                                                                                                                                   

C  ATMOSPHERIC FORCING FILE, USE WITH 28 JULY 96 AND LATER VERSIONS OF EFDC                                                                                                         

C                                                                                                                                                                                   

C  MASER     =NUMBER OF TIME DATA POINTS                                                                                                                                            

C  TCASER    =DATA TIME UNIT CONVERSION TO SECONDS                                                                                                                                  

C  TAASER    =ADDITIVE ADJUSTMENT OF TIME VALUES SAME UNITS AS INPUT TIMES                                                                                                          

C  IRELH     =0 VALUE TWET COLUMN VALUE IS TWET, =1 VALUE IS RELATIVE HUMIDITY                                                                                                      

C  RAINCVT   =CONVERTS RAIN TO UNITS OF M/SEC,inch/hour=0.0254 m/3600 s=7.0556E-6m/s                                                                                                

C  EVAPCVT   =CONVERTS EVAP TO UNITS OF M/SEC, IF EVAPCVT<0 EVAP IS INTERNALLY COMPUTED, *abs(evapcvt) in calqvs.for for TestWQ, Ji, 9/22/02                                        

C  SOLRCVT   =CONVERTS SOLAR SW RADIATION TO JOULES/SQ METER                                                                                                                        

C  CLDCVT    =MULTIPLIER FOR ADJUSTING CLOUD COVER                                                                                                                                  

C  IASWRAD   =O DISTRIBUTE SW SOL RAD OVER WATER COL AND INTO BED, =1 ALL TO SURF LAYER                                                                                             

C  REVC      =1000*EVAPORATIVE TRANSFER COEF, REVC<0 USE WIND SPD DEPD DRAG COEF                                                                                                    

C  RCHC      =1000*CONVECTIVE HEAT TRANSFER COEF, REVC<0 USE WIND SPD DEPD DRAG COEF                                                                                                

C  SWRATNF   =FAST SCALE SOLAR SW RADIATION ATTENUATION COEFFCIENT 1./METERS                                                                                                        

C  SWRATNS   =SLOW SCALE SOLAR SW RADIATION ATTENUATION COEFFCIENT 1./METERS                                                                                                        

C  FSWRATF   =FRACTION OF SOLSR SW RADIATION ATTENUATED FAST  0<FSWRATF<1                                                                                                           

C  DABEDT    =DEPTH OR THICKNESS OF ACTIVE BED TEMPERATURE LAYER, METERS                                                                                                            

C  TBEDIT    =INITIAL BED TEMPERATURE                                                                                                                                               

C  HTBED1    =CONVECTIVE HT COEFFCIENT BETWEEN BED AND BOTTOM WATER LAYER  NO DIM                                                                                                   

C  HTBED2    =HEAT TRANS COEFFCIENT BETWEEN BED AND BOTTOM WATER LAYER  M/SEC                                                                                                       

C  PATM      =ATM PRESS MILLIBAR                                                                                                                                                    

C  TDRY/TEQ  =DRY ATM TEMP ISOPT(2)=1 OR EQUIL TEMP ISOPT(2)=2                                                                                                                      

C  TWET/RELH =WET BULB ATM TEMP IRELH=0, RELATIVE HUMIDITY IRELH=1                                                                                                                  

C  RAIN      =RAIN FALL RATE LENGTH/TIME                                                                                                                                            

C  EVAP      =EVAPORATION RATE IS EVAPCVT>0.                                                                                                                                        

C  SOLSWR    =SOLAR SHORT WAVE RADIATION AT WATER SURFACE  ENERGY FLUX/UNIT AREA                                                                                                    

C  CLOUD     =FRATIONAL CLOUD COVER                                                                                                                                                 

C **  

C **  

C **  

EE    EFDC_DSI_VER: 7.301

C **  

C ** TASER(D)  PATM(MB)   TDRY(C)   TWET(C) RAIN(M/D) EVAP(M/D) SOLSWR(W/M2)  CLOUD

C **  

C **   MASER    TCASER    TAASER     IRELH     RAINCVT     EVAPCVT   SOLRCVT    CLDCVT   ! *** ID

        9547   86400.0       0.0         1  1.1574E-05  1.1574E-05       1.0       1.0   ! ASER_1

        0.000 1012.0000   22.2720    0.8550    0.0000    0.0000    0.0000    0.1000

        0.062 1012.0000   21.8340    0.8550    0.0000    0.0000    0.0000    0.1000

        0.104 1012.0000   21.6670    0.8480    0.0000    0.0000    0.0000    0.1000

        0.140 1012.0000   21.5670    0.8490    0.0000    0.0000    0.0000    0.1000

        0.188 1012.0000   21.4980    0.8460    0.0000    0.0000    0.0000    0.1000

        0.229 1012.0000   21.4970    0.8540    0.0000    0.0000    0.0000    0.1000

        0.266 1012.0000   21.3850    0.8560    0.0000    0.0000   15.6000    0.1000

        0.312 1012.0000   21.6400    0.8180    0.0000    0.0000  160.2000    0.1000

        0.354 1012.0000   21.6970    0.7980    0.0000    0.0000  259.8000    0.1000

        0.391 1012.0000   21.9650    0.8000    0.0000    0.0000  375.6000    0.1000

        0.438 1012.0000   22.6700    0.7850    0.0000    0.0000  478.8000    0.1000

        0.479 1012.0000   23.6500    0.7480    0.0000    0.0000  516.6000    0.1000

        0.516 1012.0000   24.2000    0.7120    0.0000    0.0000  529.2000    0.1000

Data Format B-26  Time and Spatial Varying Fields (TVF)

ASCII File Format for TVF

The ASCII File Format of TVF data contains two parts, firstly the file header and then the actual data. Example of an ASCII File Format:

*  TIME VARIABLE FORCING FIELD DATA - Version: XX

*  Project Title: XXX

*

*   INPT: Input format = 0: ((VALUES(T,N,L,K), K=1,KC), L=2,LA), N=1,NC)

*                       = 1:  L,I,J, (((VALUES(T,N,L,K), K=1,KC), L=1,NL), N=1,NC)

*       NT: Number of time steps

*       NC: Number of components (e.g., 1 for pressure, 2 for wind-X, wind-Y)

*       NL: Number of cells (Should = LA - 1 OR LC - 2)

*       NK: Number of layers (Default = 1)

*    ITRP: Interpolation between time steps (0 = No interp., 1 = Linear interp.)

*  IUPD: Flag to direct how to update the current cell value with the field value

*        0: Cell value will be replaced by the field value

*        1: Cell value will be added with the field value

*        2: Cell value will be the min. of the current value and the field value

*        3: Cell value will be the max. of the current value and the field value

*     IDST: Data operation after interpolation

*        0: Cell value = field value

*        1: Cell value = field value multiplies cell area

*   NODAT: No data. No update for cells with this field value

*    TSCL: Time conversion factor to seconds (should > 0, default 86400)

*    TSHF: Time shift (the same units as times, default 0)

*    VSCL: Value conversion factor to model units (should > 0, default 1)

*    VSHF: Value shift (the same units as values, default 0)

* YY MM DD: Base date

*

* INPT   NT   NC   NL   NK  ITRP IUPD IDST NODAT  TSCL TSHF  VSCL VSHF   YY MM DD

     0  721    1 3372    1     1    0    0  -999 86400    0     1    0 2005 01 01

234.875000 3372

1.00969e+3 1.00969e+3 1.00969e+3 1.00969e+3 1.00969e+3 1.00969e+3 1.00968e+3 1.00968e+3 1.00968e+3 1.00968e+3

1.00968e+3 1.00968e+3 1.00968e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3

1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00965e+3 1.00965e+3

a) ASCII File Header for TVF

The file header may start with comment lines which begin with an asterisk for descriptive information. The file header ends with one data line contains information on the TVF data as follows:

Explanation of the header fields:

Table 1: Description of the data field in TVF file header

...

INPT

...

Input format:

INPT = 0: The number of values and its order for each component the field in each time step is the same as grid cells.

INPT = 1: The number of values each component the field in each time step can be less than the number of the grid cells but the data lines should have cell indices (NL, IC, JC) in front of data values.

...

NT

...

Number of time steps.

...

NC

...

Number of components.

NC=1 for bathymetry, bottom roughness, barometric pressure, etc.

NC=2 for wind fields (X and Y components of wind speed).

...

NL

...

Number of grid cells. This is for QC to ensure the data matches the model grid.

...

NK

...

number of vertical layers (NK = 1 for this version).

...

ITRP

...

Interpolation option:

ITRP = 0: no interpolation, direct field applied at each time step.

ITRP = 1: linear interpolation between time steps.

...

IUPD

...

Flag to direct EFDC on how to update the current cell value with the reading value.

IUPD = 0: The cell value will be replaced by the reading value.

IUPD = 1: The cell value will be added with the reading value.

IUPD = 2: The cell value will be the min. of the current cell value and the reading value.

IUPD = 3: The cell value will be the max. of the current cell value and the reading value.

...

IDST

...

Specific option for data operation after interpolation

IDST = 0: Cell value = field value

IDST = 1: Cell value = field value multiplies cell area

...

TSCL

...

Conversion factor to convert time values to seconds (default 86400)

...

TSHF

...

Time offset having the same unit as time values (default 0)

...

VSCL

...

Conversion factor to convert the field values to the same units as in EFDC (default 1)

...

VSHF

...

Value offset having the same unit as the field values (default 0)

...

NODAT

...

No data value. Cells having this value will not change/not be updated by reading values.

...

YY

...

The year of the base date

...

MM

...

The month of the base date

...

DD

...

The day of the base date

b) ASCII File Data Blocks for TVF

Each data block for one time step begins with the time value (in Julian days from the base date) and a number of grid cells to which the data will be applied (should be the same as NL for INPT = 0).

For INPT = 0, the number of the data values in each block should be NC × NL × NK values and the FORTRAN command to read the data is as follows

...

READ(UNIT) TIMES(T), NL

READ(UNIT) (((VALUES(T,N,L,K), K=1,NK), L=2,LA), N=1,NC)

For INPT = 1, the number of the data values in each block can vary and the FORTRAN command to read the data is as follows

...

READ(UNIT) TIMES(T), NLA

READ(UNIT) L,I,J,(((VALUES(T,N,L,K), K=1, NK), LL=1, NLA), N=1,NC)

Binary File Format for TVF

The values and their orders in the binary file format are the same as the ASCII file format except it has no comments but a specific signature for this file format.

a) Binary File Header

The file header has a length of 80 bytes with the data fields are as the table bellows:

Description of the data field in a binary TVF file header

...

Byte Offset

...

Length (bytes)

...

Data type

...

Description

...

0

...

4

...

Integer

...

SIGNATURE (integer value 826559558 or hexadecimal value 0x31444C46 or characters "FLD1")

...

4

...

4

...

Integer

...

INPT

...

8

...

4

...

Integer

...

NT

...

12

...

4

...

Integer

...

NC

...

16

...

4

...

Integer

...

NL

...

20

...

4

...

Integer

...

NK

...

24

...

4

...

Integer

...

ITRP

...

28

...

4

...

Integer

...

IUPD

...

32

...

4

...

Integer

...

IDST

...

36

...

4

...

Float

...

NODAT

...

40

...

4

...

Float

...

TSCL

...

44

...

4

...

Float

...

TSHF

...

48

...

4

...

Float

...

VSCL

...

52

...

4

...

Float

...

VSHF

...

56

...

4

...

Integer

...

YY

...

60

...

4

...

Integer

...

MM

...

64

...

4

...

Integer

...

DD

...

68

...

4

...

Integer

...

Reserved

...

72

...

4

...

Integer

...

Reserved

...

76

...

4

...

Integer

...

Reserved

b) Binary Data Blocks for TVF

The data blocks of the binary format contain values the same as the ASCII file format.

For INPT = 0, the number of the data values in each block should be NC × LC × NK values and the FORTRAN command to read the data is as follows

...

Byte Offset

...

Length (bytes)

...

Data type

...

Description

...

0

...

8

...

Double

...

Time

...

8

...

4

...

Integer

...

Number of grid cells (NL)

...

12

...

4*NK*NL*NC

...

Single

...

Values

For INPT = 1, the number of the data values in each block can vary and the FORTRAN command to read the data is as follows

...

Byte Offset

...

Length (bytes)

...

Data type

...

Description

...

0

...

8

...

Double

...

Time

...

8

...

4

...

Integer

...

Number of grid cells having data in the block (NLA)

...

12

...

4

...

Integer

...

Cell index L

...

16

...

4

...

Integer

...

Cell index I

...

20

...

4

...

Integer

...

Cell index J

...

24

...

4*NK*NLA*NC

...

Single

...

Values

Data series from an individual cell prior to EE generating field file. 

C #time steps, series ID,

C time step, value. 

74496 L001
0.00000000000 4.785
0.01041666666 4.785
0.02083333334 4.785
0.03125000000 4.785
0.04166666666 4.785
0.05208333334 4.785
0.06250000000 4.785

This is the ASCII *FLD.INP files that EE generates from this data.

* ITYPE NT NC LC NK ITOPT IUPDATE IFLAG NODATA
0 2413 1 2121 1 0 0 0 -999
237.000000
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992

c) Examples of Code Used for Writing the Binary TVF File

FORTRAN code

!****************************************************************************

!

!  PROGRAM: WriteField

!

!  PURPOSE:  Example code to write the TVF (Time Varying Field) binary format

!            used with EFDC+/EFDC_Explorer 10.

!

!****************************************************************************

    program WriteField

    implicit none

    ! Variables

    integer :: signature, INPT, NT, NC, NL, NK, ITRP, IUPD, IDST, YY, MM, DD

    real*4 :: NODAT

    real*8, allocatable :: times(:)

    real*4, allocatable :: values(:,:,:,:)

    character*80 :: fileName   

    integer :: i,j,k,l,n, intVal

   

    INPT = 0        ! Input format (0 = all cells)

    NT = 3          ! NUMBER OF TIME STEPS

    NC = 1          ! Number of components

    NL = 29632      ! Number of cells (active cell count = LA - 1 = LC - 2)

    NK = 1          ! Number of layers

    ITRP = 1        ! Interpolation between time steps (0 = No, 1 = Linear)

    IUPD = 0        ! Update option (0 = replace, 1 = add, 2 = min, 3 = max)

    IDST = 1        ! Distribution option (0 = flux, 1 = multiplied by cell area)

    NODAT = -999.   ! No data. Ignore updating for cells with this value

    TSCL = 86400.   ! Time conversion factor to seconds (default 86400)

    TSHF = 0.       ! Time shift, same unit as time values (default 0)

    VSCL = 1.       ! Value conversion factor (default 1)

    VSHF = 0.       ! Value offset, same unit as field values (default 0)

    YY=2005         ! Base date's year

    MM=9            ! Base date's month

    DD=30           ! Base date's day

    ! Test data

    allocate(times(NT), values(NT,NC,NL,NK))

    fileName = 'evapfld.fld'

    # Write binary format

    signature = 826559558 ! 'FLD1'

    intVal = 0  ! Reserved

    open(1,file=fileName, form='binary')

    write(1) signature

    write(1) INPT

    write(1) NT

    write(1) NC

    write(1) NL

    write(1) NK

    write(1) ITRP

    write(1) IUPD

    write(1) IDST

    write(1) NODAT

    write(1) TSCL

    write(1) TSHF

    write(1) VSCL

    write(1) VSHF

    write(1) YY

    write(1) MM

    write(1) DD

    write(1) intVal

    write(1) intVal

    write(1) intVal

   

    do i=1,NT

      write(1) times(i)

      if (INPT == 0) then

        ! *** write all grid cells

        write(1) NL

        write(1) (((values(i,j,l,k), k=1,NK), l=1,NL), j=1,NC)

      else

        ! *** write only specific cells (NLA <= NL)

        !write(1) NLA

        !do n=1,NLA

        !  write(1) cell(n).L

        !  write(1) cell(n).I

        !  write(1) cell(n).J

        !  write(1) ((values(i,j,n,k), k=1,NK), j=1,NC)

        !enddo

      endif

    enddo

    close(1)

    print *, 'Hello World'

    deallocate(times, values)

   

    end program WriteField

MATLAB code

INPT = 0;           % Input format (0 = all cells)

NT = 3;             % Number of time steps

NC = 1;             % Number of components (e.g., 2 for wind-X, wind-Y)

NL = 29632;         % Number of cells (active cell count = LA - 1 = LC - 2)

NK = 1;             % Number of layers

ITRP = 1;           % Interpolation between time steps (0 = No., 1 = Linear.)

IUPD = 0;           % Update option (0 = replace, 1 = add, 2 = min, 3 = max)

IDST = 1;           % Distribution option (0 = flux, 1 = multiplied by cell area)

NODAT = -999;       % No data. Ignore updating for cells with this value

TSCL = 86400;       % Time conversion factor to seconds (default 86400)

TSHF = 0;           % Time shift, same unit as time values (default 0)

VSCL = 1;           % Value conversion factor (default 1)

VSHF = 0;           % Value offset, same unit as field values (default 0)

YY = 2005;          % Base date's year

MM = 9;             % Base date's month

DD = 30;            % Base date's day

%% Test data

times = [1, 2, 3];

values = zeros(NK,NL,NC,NT);

fileName = 'evapfld.fld';

% Write binary format

signature = 826559558; % 'FLD1'

intVal = 0;  % Reserved

fo = fopen(fileName,'w');

fwrite(fo,signature,'uint32');

fwrite(fo,INPT,'uint32');

fwrite(fo,NT,'uint32');

fwrite(fo,NC,'uint32');

fwrite(fo,NL,'uint32');

fwrite(fo,NK,'uint32');

fwrite(fo,ITRP,'uint32');

fwrite(fo,IUPD,'uint32');

fwrite(fo,IDST,'uint32');

fwrite(fo,NODAT,'float32');

fwrite(fo,TSCL,'float32');

fwrite(fo,TSHF,'float32');

fwrite(fo,VSCL,'float32');

fwrite(fo,VSHF,'float32');

fwrite(fo,YY,'uint32');

fwrite(fo,MM,'uint32');

fwrite(fo,DD,'uint32');

fwrite(fo,intVal,'uint32');

fwrite(fo,intVal,'uint32');

fwrite(fo,intVal,'uint32');

for i=1:NT,

    fwrite(fo,times(i),'double');

    if (INPT == 0),

        % *** write all grid cells

        fwrite(fo,NL,'uint32');

        fwrite(fo,values(:,:,:,i),'float32');

%         for j=1:NC,

%             for n=1:NLA,

%                 for k=1:NK,

%                     fwrite(fo,values(k,n,j,i),'float32');

%                 end;

%             end;

%         end;

25  Time and Spatial Varying Fields (TVF)

ASCII File Format for TVF

The ASCII File Format of TVF data contains two parts, firstly the file header and then the actual data. Example of an ASCII File Format:


*  TIME VARIABLE FORCING FIELD DATA - Version: XX

*  Project Title: XXX

*

*   INPT: Input format = 0: ((VALUES(T,N,L,K), K=1,KC), L=2,LA), N=1,NC)

*                       = 1:  L,I,J, (((VALUES(T,N,L,K), K=1,KC), L=1,NL), N=1,NC)

*       NT: Number of time steps

*       NC: Number of components (e.g., 1 for pressure, 2 for wind-X, wind-Y)

*       NL: Number of cells (Should = LA - 1 OR LC - 2)

*       NK: Number of layers (Default = 1)

*    ITRP: Interpolation between time steps (0 = No interp., 1 = Linear interp.)

*  IUPD: Flag to direct how to update the current cell value with the field value

*        0: Cell value will be replaced by the field value

*        1: Cell value will be added with the field value

*        2: Cell value will be the min. of the current value and the field value

*        3: Cell value will be the max. of the current value and the field value

*     IDST: Data operation after interpolation

*        0: Cell value = field value

*        1: Cell value = field value multiplies cell area

*   NODAT: No data. No update for cells with this field value

*    TSCL: Time conversion factor to seconds (should > 0, default 86400)

*    TSHF: Time shift (the same units as times, default 0)

*    VSCL: Value conversion factor to model units (should > 0, default 1)

*    VSHF: Value shift (the same units as values, default 0)

* YY MM DD: Base date

*

* INPT   NT   NC   NL   NK  ITRP IUPD IDST NODAT  TSCL TSHF  VSCL VSHF   YY MM DD

     0  721    1 3372    1     1    0    0  -999 86400    0     1    0 2005 01 01

234.875000 3372

1.00969e+3 1.00969e+3 1.00969e+3 1.00969e+3 1.00969e+3 1.00969e+3 1.00968e+3 1.00968e+3 1.00968e+3 1.00968e+3

1.00968e+3 1.00968e+3 1.00968e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3 1.00967e+3

1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00966e+3 1.00965e+3 1.00965e+3

a) ASCII File Header for TVF

The file header may start with comment lines which begin with an asterisk for descriptive information. The file header ends with one data line contains information on the TVF data as follows:

Explanation of the header fields:

Table 1: Description of the data field in TVF file header

INPT

Input format:

INPT = 0: The number of values and its order for each component the field in each time step is the same as grid cells.

INPT = 1: The number of values each component the field in each time step can be less than the number of the grid cells but the data lines should have cell indices (NL, IC, JC) in front of data values.

NT

Number of time steps.

NC

Number of components.

NC=1 for bathymetry, bottom roughness, barometric pressure, etc.

NC=2 for wind fields (X and Y components of wind speed).

NL

Number of grid cells. This is for QC to ensure the data matches the model grid.

NK

number of vertical layers (NK = 1 for this version).

ITRP

Interpolation option:

ITRP = 0: no interpolation, direct field applied at each time step.

ITRP = 1: linear interpolation between time steps.

IUPD

Flag to direct EFDC on how to update the current cell value with the reading value.

IUPD = 0: The cell value will be replaced by the reading value.

IUPD = 1: The cell value will be added with the reading value.

IUPD = 2: The cell value will be the min. of the current cell value and the reading value.

IUPD = 3: The cell value will be the max. of the current cell value and the reading value.

IDST

Specific option for data operation after interpolation

IDST = 0: Cell value = field value

IDST = 1: Cell value = field value multiplies cell area

TSCL

Conversion factor to convert time values to seconds (default 86400)

TSHF

Time offset having the same unit as time values (default 0)

VSCL

Conversion factor to convert the field values to the same units as in EFDC (default 1)

VSHF

Value offset having the same unit as the field values (default 0)

NODAT

No data value. Cells having this value will not change/not be updated by reading values.

YY

The year of the base date

MM

The month of the base date

DD

The day of the base date


b) ASCII File Data Blocks for TVF

Each data block for one time step begins with the time value (in Julian days from the base date) and a number of grid cells to which the data will be applied (should be the same as NL for INPT = 0).

For INPT = 0, the number of the data values in each block should be NC × NL × NK values and the FORTRAN command to read the data is as follows

READ(UNIT) TIMES(T), NL

READ(UNIT) (((VALUES(T,N,L,K), K=1,NK), L=2,LA), N=1,NC)


For INPT = 1, the number of the data values in each block can vary and the FORTRAN command to read the data is as follows

READ(UNIT) TIMES(T), NLA

READ(UNIT) L,I,J,(((VALUES(T,N,L,K), K=1, NK), LL=1, NLA), N=1,NC)


Binary File Format for TVF

The values and their orders in the binary file format are the same as the ASCII file format except it has no comments but a specific signature for this file format.

a) Binary File Header

The file header has a length of 80 bytes with the data fields are as the table bellows:

Description of the data field in a binary TVF file header

Byte Offset

Length (bytes)

Data type

Description

0

4

Integer

SIGNATURE (integer value 826559558 or hexadecimal value 0x31444C46 or characters "FLD1")

4

4

Integer

INPT

8

4

Integer

NT

12

4

Integer

NC

16

4

Integer

NL

20

4

Integer

NK

24

4

Integer

ITRP

28

4

Integer

IUPD

32

4

Integer

IDST

36

4

Float

NODAT

40

4

Float

TSCL

44

4

Float

TSHF

48

4

Float

VSCL

52

4

Float

VSHF

56

4

Integer

YY

60

4

Integer

MM

64

4

Integer

DD

68

4

Integer

Reserved

72

4

Integer

Reserved

76

4

Integer

Reserved


b) Binary Data Blocks for TVF

The data blocks of the binary format contain values the same as the ASCII file format.

For INPT = 0, the number of the data values in each block should be NC × LC × NK values and the FORTRAN command to read the data is as follows

Byte Offset

Length (bytes)

Data type

Description

0

8

Double

Time

8

4

Integer

Number of grid cells (NL)

12

4*NK*NL*NC

Single

Values


For INPT = 1, the number of the data values in each block can vary and the FORTRAN command to read the data is as follows

Byte Offset

Length (bytes)

Data type

Description

0

8

Double

Time

8

4

Integer

Number of grid cells having data in the block (NLA)

12

4

Integer

Cell index L

16

4

Integer

Cell index I

20

4

Integer

Cell index J

24

4*NK*NLA*NC

Single

Values

Data series from an individual cell prior to EE generating field file. 

C #time steps, series ID,

C time step, value. 

74496 L001
0.00000000000 4.785
0.01041666666 4.785
0.02083333334 4.785
0.03125000000 4.785
0.04166666666 4.785
0.05208333334 4.785
0.06250000000 4.785

This is the ASCII *FLD.INP files that EE generates from this data.

* ITYPE NT NC LC NK ITOPT IUPDATE IFLAG NODATA
0 2413 1 2121 1 0 0 0 -999
237.000000
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 
1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992 1009.992