wiki:TicketQuery

TicketQuery Wiki Macro

The TicketQuery macro lets you display ticket information anywhere that accepts WikiFormatting. The query language used by the [[TicketQuery]] macro is described in the TracQuery page.

Usage

[[TicketQuery]]

Wiki macro listing tickets that match certain criteria.

This macro accepts a comma-separated list of keyed parameters, in the form "key=value".

If the key is the name of a field, the value must use the syntax of a filter specifier as defined in TracQuery#QueryLanguage. Note that this is not the same as the simplified URL syntax used for query: links starting with a ? character. Commas (,) can be included in field values by escaping them with a backslash (\).

Groups of field constraints to be OR-ed together can be separated by a literal or argument.

In addition to filters, several other named parameters can be used to control how the results are presented. All of them are optional.

The format parameter determines how the list of tickets is presented:

  • list -- the default presentation is to list the ticket ID next to the summary, with each ticket on a separate line.
  • compact -- the tickets are presented as a comma-separated list of ticket IDs.
  • count -- only the count of matching tickets is displayed
  • rawcount -- only the count of matching tickets is displayed, not even with a link to the corresponding query (since 1.1.1)
  • table -- a view similar to the custom query view (but without the controls)
  • progress -- a view similar to the milestone progress bars

The max parameter can be used to limit the number of tickets shown (defaults to 0, i.e. no maximum).

The order parameter sets the field used for ordering tickets (defaults to id).

The desc parameter indicates whether the order of the tickets should be reversed (defaults to false).

The group parameter sets the field used for grouping tickets (defaults to not being set).

The groupdesc parameter indicates whether the natural display order of the groups should be reversed (defaults to false).

The verbose parameter can be set to a true value in order to get the description for the listed tickets. For table format only. deprecated in favor of the rows parameter

The rows parameter can be used to specify which field(s) should be viewed as a row, e.g. rows=description|summary

The col parameter can be used to specify which fields should be viewed as columns. For table format only.

For compatibility with Trac 0.10, if there's a last positional parameter given to the macro, it will be used to specify the format. Also, using "&" as a field separator still works (except for order) but is deprecated.

Examples

Example Result Macro
Number of Triage tickets: 0 [[TicketQuery(status=new&milestone=,count)]]
Number of new tickets: 0 [[TicketQuery(status=new,count)]]
Number of reopened tickets: 0 [[TicketQuery(status=reopened,count)]]
Number of assigned tickets: 1 [[TicketQuery(status=assigned,count)]]
Number of invalid tickets: 0 [[TicketQuery(status=closed,resolution=invalid,count)]]
Number of worksforme tickets: 0 [[TicketQuery(status=closed,resolution=worksforme,count)]]
Number of duplicate tickets: 0 [[TicketQuery(status=closed,resolution=duplicate,count)]]
Number of wontfix tickets: 0 [[TicketQuery(status=closed,resolution=wontfix,count)]]
Number of fixed tickets: 5 [[TicketQuery(status=closed,resolution=fixed,count)]]
Number of untriaged tickets (milestone unset): 1 [[TicketQuery(status!=closed,milestone=,count)]]
Total number of tickets: 6 [[TicketQuery(count)]]
Number of tickets reported or owned by current user: 0 [[TicketQuery(reporter=$USER,or,owner=$USER,count)]]
Number of tickets created this month: 0 [[TicketQuery(created=thismonth..,count)]]
Number of closed Firefox tickets: 0 [[TicketQuery(status=closed,keywords~=firefox,count)]]
Number of closed Opera tickets: 0 [[TicketQuery(status=closed,keywords~=opera,count)]]
Number of closed tickets affecting Firefox and Opera: 0 [[TicketQuery(status=closed,keywords~=firefox opera,count)]]
Number of closed tickets affecting Firefox or Opera: 0 [[TicketQuery(status=closed,keywords~=firefox|opera,count)]]
Number of tickets that affect Firefox or are closed and affect Opera: 0 [[TicketQuery(status=closed,keywords~=opera,or,keywords~=firefox,count)]]
Number of closed Firefox tickets that don't affect Opera: 0 [[TicketQuery(status=closed,keywords~=firefox -opera,count)]]
Last 3 modified tickets: #6, #5, #4 [[TicketQuery(max=3,order=modified,desc=1,compact)]]

Details of ticket #1:

[[TicketQuery(id=1,col=id|owner|reporter,rows=summary,table)]]

Ticket Owner Reporter
#1 arango arango
Summary Perfect Restart

Format: list

[[TicketQuery(version=0.6|0.7&resolution=duplicate)]]

This is displayed as:

No results

[[TicketQuery(id=123)]]

This is displayed as:

No results

Format: compact

[[TicketQuery(version=0.6|0.7&resolution=duplicate, compact)]]

This is displayed as:

No results

Format: count

[[TicketQuery(version=0.6|0.7&resolution=duplicate, count)]]

This is displayed as:

0

Format: progress

[[TicketQuery(milestone=0.12.8&group=type,format=progress)]]

This is displayed as:

Format: table

You can choose the columns displayed in the table format (format=table) using col=<field>. You can specify multiple fields and the order they are displayed by placing pipes (|) between the columns:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

This is displayed as:

Results (1 - 3 of 5)

1 2
Ticket Resolution Summary Owner Reporter
#6 fixed Very IMPORTANT: Added new 4DVAR operator for HF radials arango
#5 fixed typo in ad_zetabc.F somebody zhang
#4 fixed '#' is missing in tl_wrt_ini.F somebody zhang
1 2

Full rows

In table format you can specify full rows using rows=<field>:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

This is displayed as:

Results (1 - 3 of 5)

1 2
Ticket Resolution Summary Owner Reporter
#6 fixed Very IMPORTANT: Added new 4DVAR operator for HF radials arango
Description

This update is not public and the only users having access to our omlab svn repository may use it. This is an ongoing funded research. This is my private research svn branch and very few have access to it.


The 4DVar data assimilation data operators were updated to allow extra-observations type classes with multiple correspondences with the model state variables. Previously, the observation operator in obs_write.F (NLM, TLM, RPM), ad_misfit.F (ADM, primal formulation), and ad_htobs.F (ADM, dual formulation) have one-to-one correspondence with each state variable (zeta, u, v, T, S, and other passive tracers). Recall that the observation operator spatially interpolates the model at the observation locations at the appropiate time. Examples of extra-observation classes include HF radials, travel time, pressure, etc. This updade includes the observation operator to process HF radar surface velocity meassurements (radials) that affect both u- and v-momentum state variables.

  • The input 4DVAR script s4dvar.in was modified to include the extra-observation parameters:
    ! In any application, the number of observation types is computed as:
    ! NobsVar = NstateVar + NextraObs.
    !
    ! NextraObs values are expected for keywords ExtraIndex and ExtraName.
    ! If NextraVar > 1, enter one observation type names per line and
    ! use a backslash as the continuation.
    
          NextraObs = 1
    
         ExtraIndex = 20
    
          ExtraName = radial
    
    
    Here, NextraObs is the number of extra-observation classes to consider in addition to those associated with the state variables (one-to-one correspondence). They are used in observation operators that require more that one state variable to evaluate a particular extra-observation type like HF radials, travel time, pressure, etc. In any application, the number of observation types is now computed as:
         NobsVar(ng) = NstateVar(ng) + NextraObs
    
    If not processing extra-observation classes, set NextraObs=0.

The parameter ExtraIndex defines the extra-observation class identification indices, as specified in the input observation NetCDF file variable obs_type. The index has to be unique and a number greater than 7+2*NT, where NT is the total of active plus passive tracers. The 7 values include zeta, ubar, vbar, u, v, sustr, and svstr. The 2 factor for NT is to account for the surface tracer flux. Therefore, avoid using 1:7+2*NT numbers for indices because they are reserved for the state vector. Be aware that you may want to use biological data assimilation in the future. NextraObs values are expected for this keyword. This parameter is only processed when NextraObs > 0.

The keyword ExtraName defines the extra-observation class names. NextraObs values are expected. This parameter is only processed when NextraObs > 0. Enter one type name per line and use a backslash for continuation. For example:

     ExtraName = radial   \
                 pressure

Currently, however, only the radials operator is coded.

  • A new variable obs_meta is added to the input observations NetCDF file:
    	double obs_meta(datum) ;
    		obs_meta:long_name = "observation meta value" ;
    		obs_meta:units = "associated state variable units" ;
    
    The variable obs_meta contains additional data qualifiers for the extra-observation value specified in obs_value. For example, it contains the velocity radials angle (radians) from HF Radar data. The values in obs_meta for any non-radial observation are ignored.

In curvilinear coordinates, the velocity radial is defined as:

    radial = u * COS(obs_meta - angler) + v * SIN(obs_meta - angler)

where angler is the curviliar rotation angle. If no curvlinear grid, angler=0.

  • Introduced mapping indices from state variable to observation type (ObsState2Type) and its inverse from observation type to state variable (ObsType2State). It is done because the extra-observation index (ExtraIndex) may not be in sequential enumeration with respect to regular observation types.

In routine initial_fourdvar of mod_fourdvar.F, these mapping indices are allocated and initialized as follows:

!
!  Allocate and initialize observation types names and indices.
!  Notice that a mapping from state-to-type (ObsState2Type) and its
!  inverse type-to-state (ObsType2State) indices are needed because
!  the User is allowed to add extra-observation operators with
!  nonsequential type enumeration.
!
!  Both mapping arrays ObsState2Type and ObsType2State have a zero
!  array element to allow applications with no extra-observations
!  to work with their zero associated state index (as initialized
!  in mod_ncparam.F).  For example, if the index "isRadial" is not
!  redefined below, the following assignment
!
!        ObsState2Type(isRadial)=ObsState2Type(0)=0
!        ObsType2State(isRadial)=ObsType2State(0)=0
!
!  is still legal with isRadial=0. It avoids a Fortran segmentation
!  violation (i.e., subscript #1 of the array ObsState2Type has
!  value 0 which is less than the lower bound of 1).  Sorry for
!  the awkward logic but we need a generic way to specify extra-
!  observation operators.
!
      allocate ( ObsName(MAXVAL(NobsVar)) )
      icount=MAXVAL(NstateVar)
      ObsState2Type(0)=0
      DO i=1,icount                               ! 5+NT
        ObsState2Type(i)=i
        ObsName(i)=TRIM(Vname(1,idSvar(i)))
      END DO
      IF (NextraObs.gt.0) THEN
        DO i=1,NextraObs
          icount=icount+1
          ObsName(icount)=TRIM(ExtraName(i))
          SELECT CASE (TRIM(uppercase(ExtraName(i))))
            CASE ('RADIAL')
              isRadial=icount
              ObsState2Type(icount)=ExtraIndex(i)
          END SELECT
        END DO
      END IF

In obs_write.F, the ObsState2Type is used as follows:

          CALL extract_obs3d (ng, 1, Lm(ng)+1, 0, Mm(ng)+1,             &
     &                        LBi, UBi, LBj, UBj, 1, N(ng),             &
     &                        ObsState2Type(isRadial),                  & !<==
     &                        Mobs, Mstr, Mend,                         &
     &                        uXmin(ng)+0.5_r8, uXmax(ng)+0.5_r8,       &
     &                        uYmin(ng), uYmax(ng),                     &
     &                        time(ng), dt(ng),                         &
     &                        ObsType,  ObsVetting,                     &
     &                        Tobs, Xobs+0.5_r8, Yobs, Zobs,            &
     &                        OCEAN(ng)%u(:,:,:,NOUT),                  &
     &                        GRID(ng)%z_v,                             &
#   ifdef MASKING
     &                        GRID(ng)%umask,                           &
#   endif
     &                        uradial)

In obs_cost.F, the reverse mapping ObsType2State is used as follows:

       DO iobs=NstrObs(ng),NendObs(ng)
         ivar=ObsType2State(ObsType(iobs))                        !<==                                                       
         IF ((ivar.gt.0).and.(ObsScale(iobs).gt.0.0_r8).and.           &
    &        (ObsErr(iobs).ne.0.0_r8)) THEN
           cff=ObsScale(iobs)*(NLmodVal(iobs)-ObsVal(iobs))**2/        &
    &          ObsErr(iobs)
           my_ObsCost(0)=my_ObsCost(0)+cff
           my_ObsCost(ivar)=my_ObsCost(ivar)+cff
         END IF
       END DO
  • Modified routined obs_write.F, ad_misfit.F, and ad_htob.F to include the HF Radar data operator:
    !
    !  Compute NLM radial velocity.
    !
              DO iobs=Mstr,Mend
                IF (ObsType(iobs).eq.ObsState2Type(isRadial)) THEN
    #   ifdef CURVGRID
                  angle=ObsMeta(iobs)-ObsAngler(iobs)
                  NLmodVal(iobs)=uradial(iobs)*COS(angle)+                  &
         &                       vradial(iobs)*SIN(angle)
    #   else
                  NLmodVal(iobs)=uradial(iobs)*COS(ObsMeta(iobs))+          &
         &                       vradial(iobs)*SIN(ObsMeta(iobs))
    #   endif
    #   ifdef BGQC
                  BgErr(iobs)=MAX(uBgErr(iobs), vBgErr(iobs))
    #   endif
                END IF
              END DO
    
    where uradial and vradial are the model velocities interpolated to the radial velocity locations in space and time, obs_angler is the curvilinear grid angle interpolated at the radial locations, and obs_meta is the HF radar radial angle.

The adjoint forcing is simply:

        IF (FOURDVAR(ng)%ObsCount(isRadial).gt.0) THEN
          DO iobs=1,Nobs(ng)
            ad_uradial(iobs)=IniVal
            ad_vradial(iobs)=IniVal
          END DO
          DO iobs=1,Nobs(ng)
            IF (ObsType(iobs).eq.ObsState2Type(isRadial)) THEN
#  ifdef CURVGRID
              angle=ObsMeta(iobs)-ObsAngler(iobs)
              ad_uradial(iobs)=ad_uradial(iobs)+                        &
     &                         ADmodVal(iobs)*COS(angle)
              ad_vradial(iobs)=ad_vradial(iobs)+                        &
     &                         ADmodVal(iobs)*SIN(angle)
#  else
              ad_uradial(iobs)=ad_uradial(iobs)+                        &
     &                         ADmodVal(iobs)*COS(ObsMeta(iobs))
              ad_vradial(iobs)=ad_vradial(iobs)+                        &
     &                         ADmodVal(iobs)*SIN(ObsMeta(iobs))
#  endif
            END IF
          END DO
          ...
        END IF

  • The HF radial assimilation was tested with Brian Powell Hawaii application. Both IS4DVAR and W4DPSAS gives identical cost functions.

https://www.myroms.org/trac/hawaii_radials_penalty.png


Many thanks to Brain Powell for his help in the coding and testing of the HF Radar operator to assimilate surface velocity radials.


Corrected a bug in ad_misfit.F and obs_write.F in the managing of the screening and quality control variable obs_scale for the primal formulation. The issue is that in the primal formulation (IS4DVAR), the current time window (or survey) observations are loaded to the working arrays using local indices (array elements 1:Nobs) as opposed to global indices in the dual formulation (W4DPSAS and W4DVAR). Recall that the screening variable ObsScale is computed only once to facilitate Background Quality Control on the first pass of the NLM (WrtObsScale=T and wrtNLmod=T). Therefore, we need to load and save values into global array ObsScaleGlobal so it can be used correctly by the TLM, RPM, and ADM.

# ifndef WEAK_CONSTRAINT
!
!-----------------------------------------------------------------------
!  Save observation reject/accept flag in GLOBAL screening variable.
!-----------------------------------------------------------------------
!
        IF (wrtObsScale(ng).and.wrtNLmod(ng)) THEN
          ic=0
          DO iobs=NstrObs(ng),NendObs(ng)
            ic=ic+1
            ObsScaleGlobal(iobs)=ObsScale(ic)
          END DO
        ELSE
          ic=0
          DO iobs=NstrObs(ng),NendObs(ng)
            ic=ic+1
            ObsScale(ic)=ObsScaleGlobal(iobs)
          END DO
        END IF
# endif

Then, in ad_misfit.F, we just need to load the correct ObsScale for the current time assimilation window:

!
!-----------------------------------------------------------------------
!  Load observation reject and accept flag into screening variable.
!-----------------------------------------------------------------------
!
        ic=0
        DO iobs=NstrObs(ng),NendObs(ng)
          ic=ic+1
          ObsScale(ic)=ObsScaleGlobal(iobs)
        END DO
#5 fixed typo in ad_zetabc.F somebody zhang
Description

in ad_zetabc.F, line 99: ad_Ce=0.0_r8

it should be: ad_Cx=0.0_r8

#4 fixed '#' is missing in tl_wrt_ini.F somebody zhang
Description

Line 395 in tl_wrt_ini.F.

'#' is missing in front of 'endif'

1 2


See also: TracQuery, TracTickets, TracReports

Last modified 3 years ago Last modified on 10/12/21 17:00:26
Note: See TracWiki for help on using the wiki.