[Thread Prev][Thread Next][Index]

Re: [ferret_users] problem in external function custom axis



Hi Serena,

I think your call to ef_box_size has a mistake; see below.

-- Karl


On Tue, Sep 11, 2012 at 6:21 AM, Serena Illig <serena.illig@xxxxxxxxx> wrote:
Dear all,

I am triing to write an external function with 4 arguments that will have a custom Z axis.
I can create the ABSTRACT axis without any problem, but when I try to create the CUSTOM axis, I can not get realistic values of arg_lo_ss, arg_hi_ss.
But these values are correct in the subroutines test_results_limits and test_cumpute. They remain equal to one in test_custom_axes.

Thanks !

Here is my function :


      SUBROUTINE test_init(id)

      INCLUDE 'EF_Util.cmn'

      INTEGER id, arg
*
* **********************************************************************
*                                            USER CONFIGURABLE PORTION |
*                                                                      |
*
      CALL ef_set_desc(id,'test')
*
      CALL ef_set_num_args(id, 4)
      CALL ef_set_has_vari_args(id, NO)
      CALL ef_set_axis_inheritance(id, IMPLIED_BY_ARGS,
     .     IMPLIED_BY_ARGS, CUSTOM, IMPLIED_BY_ARGS)
      CALL ef_set_piecemeal_ok(id, YES, YES, NO, NO)
*
      arg = 1
      CALL ef_set_arg_name(id, arg, 'Input')
      CALL ef_set_arg_desc(id, arg, 'Input')
      CALL ef_set_axis_influence(id, arg, YES, YES, NO, YES)
*
      arg = 2
      CALL ef_set_arg_name(id, arg, 'test')
      CALL ef_set_arg_desc(id, arg, 'test')
      CALL ef_set_axis_influence(id, arg, NO, NO, NO, NO)

      arg = 3
      CALL ef_set_arg_name(id, arg, 'param')
      CALL ef_set_arg_desc(id, arg, 'Parameter')
      CALL ef_set_axis_influence(id, arg, NO, NO, NO, NO)
*
      arg = 4
      CALL ef_set_arg_name(id, arg, 'dj')
      CALL ef_set_arg_desc(id, arg, 'resolution')
      CALL ef_set_axis_influence(id, arg, NO, NO, NO, NO)
*
*                                                                      ^
*                                                                      |
*                                            USER CONFIGURABLE PORTION |
* **********************************************************************

      RETURN
      END


      SUBROUTINE test_results_limits(id)
      implicit none
      INCLUDE 'EF_Util.cmn'
      INCLUDE 'EF_mem_subsc.cmn'
      INTEGER arg_lo_ss(4,EF_MAX_ARGS), arg_hi_ss(4,EF_MAX_ARGS),
     .     arg_incr(4,EF_MAX_ARGS)
      INTEGER n, jtot, mother, arg, id
      REAL value,dj,s0,dt
      REAL boxsize(1)

      CALL ef_get_arg_subscripts(id, arg_lo_ss, arg_hi_ss, arg_incr)
      n=arg_hi_ss(T_AXIS,ARG1)-arg_lo_ss(T_AXIS,ARG1)+1

      arg = 1
      CALL ef_get_box_size(id, arg, T_AXIS, arg_lo_ss(T_AXIS,arg),
     .               arg_lo_ss(T_AXIS,arg), boxsize)

I think you should have arg_hi_ss instead of arg_lo_ss for the fifth argument.
 
      dt=boxsize(1)

      arg = 2
      CALL ef_get_one_val(id, arg, value)
      mother = int(value)
   
      arg = 4
      CALL ef_get_one_val(id, arg, dj) 
      if (mother.eq.0) s0=dt
      if (mother.eq.1) s0=dt/4.
      if (mother.eq.2) s0=2.*dt
      jtot=NINT(REAL(NINT(1+(LOG(n*dt/s0))/LOG(2.)))/dj)

      CALL ef_set_axis_limits(id, Z_AXIS, 1, jtot)
     
* **********************************************************************

      RETURN
      END


      SUBROUTINE test_custom_axes(id)
      implicit none
      INCLUDE 'EF_Util.cmn'
      INCLUDE 'EF_mem_subsc.cmn'
      CHARACTER outunits*32

      INTEGER arg_lo_ss(4,EF_MAX_ARGS), arg_hi_ss(4,EF_MAX_ARGS),
     .     arg_incr(4,EF_MAX_ARGS)
      INTEGER n, jtot, mother, arg, id
      REAL value,dj,s0,dt
      REAL boxsize(1)

      CALL ef_get_arg_subscripts(id, arg_lo_ss, arg_hi_ss, arg_incr)
      n=arg_hi_ss(T_AXIS,ARG1)-arg_lo_ss(T_AXIS,ARG1)+1

      arg = 1
      CALL ef_get_box_size(id, arg, T_AXIS, arg_lo_ss(T_AXIS,arg),
     .               arg_lo_ss(T_AXIS,arg), boxsize)
      dt=boxsize(1)

      arg = 2
      CALL ef_get_one_val(id, arg, value)
      mother = int(value)
   
      arg = 4
      CALL ef_get_one_val(id, arg, dj) 
      if (mother.eq.0) s0=dt
      if (mother.eq.1) s0=dt/4.
      if (mother.eq.2) s0=2.*dt
      jtot=NINT(REAL(NINT(1+(LOG(n*dt/s0))/LOG(2.)))/dj)
      outunits='Scale Number'
      CALL ef_set_custom_axis (id, Z_AXIS, dj, float(jtot)*dj, dj,
     .   outunits, NO)

     
* **********************************************************************

      RETURN
      END
*





.¸. , . .·´¯`·
 ><(((º>     `·.¸.·´¯`·...¸><(((º>¸.¸. , . .·´¯`· ><(((º> .
`·.¸.·´¯`·...¸><(((º>                                              .
                                                                        .
  Serena THEVENIN-ILLIG          LEGOS/IRD      .
                                                                      .
                         14 Av. E. Belin                      .
                         31400 Toulouse                    .
                         FRANCE                              .
                                                                      .
         E-mail : serena.illig@xxxxxxxxx               .
         Phone : +33 5 61 33 30 56                     .
         Fax     : +33 5 61 25 32 05                  .
                                                              .
                                            <º)))><..·´





--
Karl M. Smith, Ph.D.
JISAO Univ. Wash. and TMAP/PMEL NOAA
"The contents of this message are mine personally and do
not necessarily reflect any position of the Government
or the National Oceanic and Atmospheric Administration."


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement