code: def gdate_to_rdate(gyear, gmonth, gday):
      r"""Convert Gregorian date to RDate format.
  
      Parameters
      ----------
      gyear : int
          Gregorian year.
      gmonth : int
          Gregorian month.
      gday : int
          Gregorian day.
  
      Returns
      -------
      rdate : int
          RDate date format.
      """
  
      if gmonth <= 2:
          rfactor = 0
      elif gmonth > 2 and leap_year(gyear):
          rfactor = -1
      else:
          rfactor = -2
  
      rdate = (
          365 * (gyear - 1)
          + math.floor((gyear - 1) / 4)
          - math.floor((gyear - 1) / 100)
          + math.floor((gyear - 1) / 400)
          + math.floor(((367 * gmonth) - 362) / 12)
          + gday
          + rfactor
      )
      return rdate
  
imports: import calendar
  import logging
  import math
  import pandas
label_desc: Use image node_id 8 for calling a global function with example usage: gdate_to_rdate(gyear, gmonth, gday) and returns: rdate