[MITgcm-support] accessing diagnostic values

Jean-Michel Campin jmc at ocean.mit.edu
Wed Aug 3 19:31:34 EDT 2011


Hi Nikole,

If you want to get access directly 1 diagnostic field, in some places 
of the code, you can use the 2 S/R 
DIAGNOSTICS_GET_POINTERS & DIAGNOSTICS_GET_DIAG
(both inside pkg/diagnostics/diagnostics_utils.F)
Note that if you don't know the listId (for DIAGNOSTICS_GET_POINTERS
call) you can specify 0 and it will return the 1rst found
(see DIAGNOSTICS_GET_POINTERS description in diagnostics_utils.F).
An example can be found in pkg/diagnostics/diagnostics_interp_vert.F

And regarding this:
> Also is there a way to 'turn off' the output so that a file isn't created 
> at the specified timestep, but the diagnostics are still calculated?
I am not sure. If you try to change the definition (in the corresponding 
*diagnostics*init*) of the parsing code (e.g., for THETA, in diagnostics_main_init.F,
changing diagCode) to put "D" in fifth position, it will not longer write this diag.
But not sure that it's what you want.

Cheers,
Jean-Michel

On Wed, Aug 03, 2011 at 04:05:58PM -0700, Yuan Lian wrote:
> Hi Nikole,
> 
> In the data.diagnostics, frequency(n) is the time average frequency
> if it's positive. It can also be snapshot frequency if it's negative (or
> 0 means output every time step).
> 
> The diagnostics output is defined by the filename(n), which is a
> 4D array. If you want to access THETA, the you load 'UWTave.0000...'
> and theta=UWTave(:,:,:,1).
> 
> I am not sure what you meant "access some of the diagnostic calculation".
> Do you mean using the time averaged theta over frequency(1) during
> runtime? If this is what you meant, it is more convenient to use the
> dynamic variables defined in "timeave" package. You will need to
> include the
> header file "TIMEAVE_STATV.h", where you can see "thetatave" etc.  The
> time average frequency is defined by "taveFreq" in "data" file.
> 
> Hope this help.
> 
> Cheers,
> Yuan
> 
> 
> On 8/3/11 3:12 PM, Nikole Lewis wrote:
> >All-
> >    I'd like to access some of the diagnostic calculations for use in
> >other parts of the code.  I've pasted below my data.diagnostics file
> >as well as relevant information from the STDOUT files.  How would I
> >access say the 'THETA' value?  Also is there a way to 'turn off' the
> >output so that a file isn't created at the specified timestep, but the
> >diagnostics are still calculated?  Thanks in advance for any help.
> >
> >-Nikole Lewis
> >
> >
> ># Diagnostic Package Choices
> >#-----------------
> ># for each output-stream:
> >#  filename(n) : prefix of the output file name (only 8.c long) for
> >outp.stream n
> >#  frequency(n):<  0 : write snap-shot output every |frequency| seconds
> >#>  0 : write time-average output every frequency seconds
> >#  timePhase(n)     : write at time = timePhase + multiple of |frequency|
> >#  levels(:,n) : list of levels to write to file (Notes: declared as REAL)
> >#                 when this entry is missing, select all common levels
> >of this list
> >#  fields(:,n) : list of diagnostics fields (8.c) (see
> >"available_diagnostics" file
> >#                 for the list of all available diag. in this particular config)
> >#-----------------
> >  &diagnostics_list
> >   frequency(1) = 86400.e2,
> >    filename(1) = 'UVWTave',
> >    fields(1,1) = 'THETA','UVEL','VVEL','WVEL',
> >   frequency(2) = 86400.e2,
> >    filename(2) = 'TRANS',
> >    fields(1,2) = 'UV_VEL_C','UV_VEL_Z','WU_VEL',
> >   frequency(3) = 86400.e2,
> >    filename(3) = 'VELTH',
> >    fields(1,3) = 'UVELTH','VVELTH','WVELTH',
> >   frequency(4) = 86400.e2,
> >    filename(4) = 'ADVTH',
> >    fields(1,4) = 'ADVr_TH','ADVx_TH','ADVy_TH',
> >   frequency(5) = 86400.e2,
> >    filename(5) = 'ADVU',
> >    fields(1,5) = 'ADVx_Um','ADVy_Um','ADVrE_Um',
> >   frequency(6) = 86400.e2,
> >    filename(6) = 'SHAP',
> >    fields(1,6) = 'SHAP_dT','SHAP_dU',
> >   frequency(7) = 86400.e2,
> >    filename(7) = 'TEND',
> >    fields(1,7) = 'TOTUTEND','TOTTTEND',
> >  &
> >
> ># Parameter for Diagnostics of per level statistics:
> >#-----------------
> ># for each output-stream:
> >#  stat_fname(n) : prefix of the output file name (only 8.c long) for
> >outp.stream n
> >#  stat_freq(n):<  0 : write snap-shot output every |stat_freq| seconds
> >#>  0 : write time-average output every stat_freq seconds
> >#  stat_phase(n)    : write at time = stat_phase + multiple of |stat_freq|
> >#  stat_region(:,n) : list of "regions" (default: 1 region only=global)
> >#  stat_fields(:,n) : list of diagnostics fields (8.c) (see
> >"available_diagnostics.log"
> >#                 file for the list of all available diag. in this
> >particular config)
> >#-----------------
> >  &DIAG_STATIS_PARMS
> >#- an example just to check the agreement with MONITOR output:
> ># stat_fields(1,1)= 'ETAN    ','UVEL    ','VVEL    ','WVEL    ', 'THETA   ',
> >#    stat_fname(1)= 'dynStDiag',
> >#    stat_freq(1)= -864000.,
> >#     stat_freq(1)= -3600.,
> >#   stat_phase(1)= 0.,
> >  &
> >
> >
> >------------------------------------------------------------------------
> >2D/3D diagnostics: Number of lists:     7
> >------------------------------------------------------------------------
> >listId=   1 ; file name: UVWTave
> >  nFlds, nActive,       freq&    phase        , nLev
> >    4  |   4  |   8640000.000000         0.000000 |  76
> >  levels:   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
> >16  17  18  19  20  21  22  23  24  25
> >  levels:  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40
> >41  42  43  44  45  46  47  48  49  50
> >  levels:  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65
> >66  67  68  69  70  71  72  73  74  75
> >  levels:  76
> >  diag#| name   | ipt  | iMate| kLev| count | mate.C|
> >    26 |THETA   |    1 |    0 |  76 |     0 |
> >    29 |UVEL    |   77 |  153 |  76 |     0 |     0 |
> >    30 |VVEL    |  153 |   77 |  76 |     0 |     0 |
> >    31 |WVEL    |  229 |    0 |  76 |     0 |
> >------------------------------------------------------------------------
> >listId=   2 ; file name: TRANS
> >  nFlds, nActive,       freq&    phase        , nLev
> >    3  |   3  |   8640000.000000         0.000000 |  76
> >  levels:   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
> >16  17  18  19  20  21  22  23  24  25
> >  levels:  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40
> >41  42  43  44  45  46  47  48  49  50
> >  levels:  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65
> >66  67  68  69  70  71  72  73  74  75
> >  levels:  76
> >  diag#| name   | ipt  | iMate| kLev| count | mate.C|
> >    37 |UV_VEL_C|  305 |  305 |  76 |     0 |     0 |
> >    38 |UV_VEL_Z|  381 |  381 |  76 |     0 |     0 |
> >    39 |WU_VEL  |  457 |    0 |  76 |     0 |
> >------------------------------------------------------------------------
> >listId=   3 ; file name: VELTH
> >  nFlds, nActive,       freq&    phase        , nLev
> >    3  |   3  |   8640000.000000         0.000000 |  76
> >  levels:   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
> >16  17  18  19  20  21  22  23  24  25
> >  levels:  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40
> >41  42  43  44  45  46  47  48  49  50
> >  levels:  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65
> >66  67  68  69  70  71  72  73  74  75
> >  levels:  76
> >  diag#| name   | ipt  | iMate| kLev| count | mate.C|
> >    50 |UVELTH  |  533 |  609 |  76 |     0 |     0 |
> >    51 |VVELTH  |  609 |  533 |  76 |     0 |     0 |
> >    52 |WVELTH  |  685 |    0 |  76 |     0 |
> >
> >listId=   4 ; file name: ADVTH
> >  nFlds, nActive,       freq&    phase        , nLev
> >    3  |   3  |   8640000.000000         0.000000 |  76
> >  levels:   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
> >16  17  18  19  20  21  22  23  24  25
> >  levels:  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40
> >41  42  43  44  45  46  47  48  49  50
> >  levels:  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65
> >66  67  68  69  70  71  72  73  74  75
> >  levels:  76
> >  diag#| name   | ipt  | iMate| kLev| count | mate.C|
> >    90 |ADVr_TH |  761 |    0 |  76 |     0 |
> >    91 |ADVx_TH |  837 |  913 |  76 |     0 |     0 |
> >    92 |ADVy_TH |  913 |  837 |  76 |     0 |     0 |
> >------------------------------------------------------------------------
> >listId=   5 ; file name: ADVU
> >  nFlds, nActive,       freq&    phase        , nLev
> >    3  |   3  |   8640000.000000         0.000000 |  76
> >  levels:   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
> >16  17  18  19  20  21  22  23  24  25
> >  levels:  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40
> >41  42  43  44  45  46  47  48  49  50
> >  levels:  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65
> >66  67  68  69  70  71  72  73  74  75
> >  levels:  76
> >  diag#| name   | ipt  | iMate| kLev| count | mate.C|
> >   153 |ADVx_Um |  989 | 1065 |  76 |     0 |     0 |
> >   154 |ADVy_Um | 1065 |  989 |  76 |     0 |     0 |
> >   155 |ADVrE_Um| 1141 |    0 |  76 |     0 |
> >------------------------------------------------------------------------
> >listId=   6 ; file name: SHAP
> >  nFlds, nActive,       freq&    phase        , nLev
> >    2  |   2  |   8640000.000000         0.000000 |  76
> >  levels:   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
> >16  17  18  19  20  21  22  23  24  25
> >  levels:  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40
> >41  42  43  44  45  46  47  48  49  50
> >  levels:  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65
> >66  67  68  69  70  71  72  73  74  75
> >  levels:  76
> >  diag#| name   | ipt  | iMate| kLev| count | mate.C|
> >   167 |SHAP_dT | 1217 |    0 |  76 |     0 |
> >   169 |SHAP_dU | 1293 |    0 |  76 |     0 |
> >------------------------------------------------------------------------
> >listId=   7 ; file name: TEND
> >  nFlds, nActive,       freq&    phase        , nLev
> >    2  |   2  |   8640000.000000         0.000000 |  76
> >  levels:   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
> >16  17  18  19  20  21  22  23  24  25
> >  levels:  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40
> >41  42  43  44  45  46  47  48  49  50
> >  levels:  51  52  53  54  55  56  57  58  59  60  61  62  63  64  65
> >66  67  68  69  70  71  72  73  74  75
> >  levels:  76
> >  diag#| name   | ipt  | iMate| kLev| count | mate.C|
> >    86 |TOTUTEND| 1369 |    0 |  76 |     0 |
> >    88 |TOTTTEND| 1445 |    0 |  76 |     0 |
> >
> >_______________________________________________
> >MITgcm-support mailing list
> >MITgcm-support at mitgcm.org
> >http://mitgcm.org/mailman/listinfo/mitgcm-support
> 
> 
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support



More information about the MITgcm-support mailing list