
46 Cal.App.4th 298 (1996)
THE PEOPLE, Plaintiff and Respondent,
v.
TIFFANY ANNE PENOLI, Defendant and Appellant.
Docket No. A068547.
Court of Appeals of California, First District, Division Two.
June 6, 1996.
*300 COUNSEL
Houghton Gifford, under appointment by the Court of Appeal, for Defendant and Appellant.
Daniel E. Lungren, Attorney General, George Williamson, Chief Assistant Attorney General, Ronald A. Bass, Assistant Attorney General,
*301 Laurence C. Sullivan and Aileen Bunney, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
KLINE, P.J.
The trial court placed Tiffany Anne Penoli on probation after she pled guilty to possessing methamphetamines. On appeal her attorney filed a brief pursuant to People v. Wende (1979) 25 Cal.3d 436 [158 Cal. Rptr. 839, 600 P.2d 1071], requiring this court to independently review the record for arguable error. We directed the parties to brief the following issues: (1) Did the trial court err by adhering to a self-described "standard practice" of requiring, as a condition of probation, a prospective waiver of credit for time spent in residential drug rehabilitation? (2) Did the court delegate excessive judicial authority to the probation department to select a drug rehabilitation program? We have concluded that the first question must be answered affirmatively. Accordingly, we will reverse the order granting probation.

BACKGROUND
According to the probation report, police were summoned in November 1994 by defendant's sister, who told them defendant had entered her home without permission and had then departed, leaving behind three bindles of suspected methamphetamine. When questioned by police, defendant acknowledged injecting and possessing the substance, which tests confirmed to be 1.18 grams of methamphetamine. Defendant, who was 25 years old, told the probation officer she had used methamphetamine daily since she was a teenager, and had a $60-a-day habit at the time of the offense.
Defendant was charged with possessing methamphetamine in violation of Health and Safety Code section 11377, subdivision (a). She entered a guilty plea on the understanding that "she would receive no immediate State prison" on the methamphetamine charge and that other pending cases against her would be dismissed or reduced to time served.
The probation officer recommended that as a condition of probation, defendant be required to enter a residential drug treatment program "as approved by the Probation Officer," and that she "remain there until she has successfully completed that program (with no credit for time served while in the program)." Defendant filed a sentencing memorandum, objecting that this condition constituted an improper delegation of judicial authority to the probation department and was fatally vague insofar as it prescribed only the *302 completion of drug treatment as directed by the probation officer. (1) (See fn. 1.) She also asserted that the proposed denial of credit for time served in such a program was contrary to Penal Code section 2900.5,[1] which expressly allowed such credit.
The court overruled defendant's objections and granted probation on terms materially identical to those recommended by the probation officer. Defendant filed a timely notice of appeal, specifically referring to the probation conditions challenged in the sentencing memorandum.[2]

I.
(2) "Trial courts are granted broad discretion under Penal Code section 1203.1 to prescribe conditions of probation." (People v. Richards (1976) 17 Cal.3d 614, 619 [131 Cal. Rptr. 537, 552 P.2d 97], disapproved on another point in People v. Carbajal (1995) 10 Cal.4th 1114, 1126 [43 Cal. Rptr.2d 681, 899 P.2d 67]; see People v. Pointer (1984) 151 Cal. App.3d 1128, 1136 [199 Cal. Rptr. 357].) However, a ruling otherwise within the trial court's power will nonetheless be set aside where it appears from the record that in issuing the ruling the court failed to exercise the discretion vested in it by law. (People v. Beasley (1970) 5 Cal. App.3d 617, 633-634 [85 Cal. Rptr. 501]; People v. Wallace (1963) 59 Cal.2d 548, 553 [30 Cal. Rptr. 449, 381 P.2d 185]; In re Brumback (1956) 46 Cal.2d 810, 813 [299 P.2d 217]; see People v. Ruby (1988) 204 Cal. App.3d 462, 466-468 [251 Cal. Rptr. 339], review den.; People v. Jasper (1983) 33 Cal.3d 931, 935 [191 Cal. Rptr. 648, 663 P.2d 206].)
(3a) At the sentencing hearing, defense counsel correctly observed that under section 2900.5, time spent in a residential treatment program operates as a credit against any future confinement which might occur.[3] The court observed, however, that as with other credits, the statutory entitlement to *303 credit for time served is subject to waiver. This court had specifically so held, and had refused to overturn a probation condition requiring a defendant to waive future credit for time served in an alcohol treatment program, in People v. Ambrose (1992) 7 Cal. App.4th 1917, 1921, 1923 [9 Cal. Rptr.2d 812]. Had the court merely cited that rule, we would presume that in imposing such a condition on defendant it was exercising a sound discretion; the resulting order might well be impervious to appellate challenge. (See id. at p. 1925.)
To its credit, however, the trial court here went on to frankly disclose its reasons for requiring a waiver of credit  reasons which the court acknowledged to be in flat opposition to the legislative policy judgments reflected in section 2900.5. The court opined that no public purpose is served by allowing credit for "time served in a failed effort at rehabilitation," whereas "a very big public purpose is served by causing a defendant to make the choice at the beginning about whether he or she wants to go into a program ... knowing that the only benefit that will accrue from being there will accrue if he or she completes the program." Accordingly, the court declared, "it will be an unusual case that I won't require a waiver of time credits for time served while in the program as a standard practice in court until there is specific case law that says having that as a standard practice is an excess of jurisdiction or an abuse of discretion." Acknowledging that this "standard practice" conflicted with the legislative policy of section 2900.5, the court stated, "I think my reasons are better than the [L]egislature's reasons. As long as I think I have the legal power to act on mine I'm going to do it."
The court's "standard practice" represents not a case-specific application of sentencing discretion, but a preconceived determination applicable to all cases in which the question might arise. Adherence to this practice constituted an erroneous failure to exercise the discretion vested in the court by law. (See People v. Jasper, supra, 33 Cal.3d at p. 935 [if trial court had "routine practice" as to discretionary scheduling matter, it was improper]; Mark F. v. Superior Court (1987) 189 Cal. App.3d 206, 210-212 [234 Cal. Rptr. 388], review den. [probation department abused discretion by applying inflexible policy of denying probation to juveniles charged with drunk driving]; cf. People v. Preyer (1985) 164 Cal. App.3d 568, 574 [210 Cal. Rptr. 807] [discretionary ruling must be assessed on particular facts of case, not statistics].)
Seeking to avoid this conclusion, respondent notes that the trial court alluded to the possibility that in an "unusual case" it might forego its "standard practice." This possibility does not alter the fact that the ruling here appeared to rest on the rote application of a blanket rule and not an *304 individualized exercise of discretion. (See People v. Hodgkin (1987) 194 Cal. App.3d 795, 810-811 [239 Cal. Rptr. 831] [sentence remanded for "particularized inquiry" into defendant's ability to comply with conditions].)
Furthermore, even if the court's "standard practice" allowed for exceptions, it explicitly reversed the rule prescribed by the Legislature and substituted a contrary rule based on the court's disagreement with legislative policy judgments. The court was quite explicit about this, explaining its "practice" by stating that its reasons for denying credit were "better than the Legislature's reasons" for allowing it. The discretion granted sentencing courts must be exercised with a view toward effectuating, not frustrating, legislative policy. (See People v. Ortiz (1964) 61 Cal.2d 249, 254-255 [37 Cal. Rptr. 891, 391 P.2d 163]; People v. Ruby, supra, 204 Cal. App.3d at p. 468.) A sentencing determination predicated on the judicial repudiation of legislative policy constitutes an abuse of discretion. (People v. Dent (1995) 38 Cal. App.4th 1726, 1731 [45 Cal. Rptr.2d 746] [discretionary sentencing determination "can be properly made only when the sentencing court focuses on considerations that are pertinent to the specific defendant being sentenced, not an aversion to a particular statutory scheme"].) The probation condition challenged here falls within this rule.
Moreover, even if the trial court's adherence to its "standard practice" were not otherwise infirm, its expressed reasoning is untenable. The court was apparently troubled by the possibility that under the normal operation of section 2900.5, a defendant would be insufficiently motivated to complete a drug rehabilitation program because of the knowledge that he or she could enter such a program, remain as long as the conditions of confinement seemed less onerous than jail, drop out when this ceased to be the case, and receive credit as though he or she had been incarcerated.[4] The result, as the court apparently reasoned, was that a defendant would be encouraged to enter such a program even if she had no commitment to its successful conclusion, secure in the knowledge that, at worst, she would still receive credit as if she had been imprisoned.
The first flaw in this analysis is that it supposes a false equivalence between credit for time spent in a rehabilitation center and credit for jail or *305 prison time. In fact the former does not earn as much credit as the latter. Section 2931 grants conduct credits to persons confined in state prison. Section 4019 grants similar credits to persons "confined in or committed to a county jail, industrial farm, or road camp, or any city jail, industrial farm, or road camp." (§ 4019, subd. (a)(1).) No such credits are allowed to persons confined in a rehabilitation or similar facility. (People v. Ambrose, supra, 7 Cal. App.4th at p. 1925; People v. Broad (1985) 165 Cal. App.3d 882, 884 [211 Cal. Rptr. 679].) As a result of this legislative distinction, a person who spends time in a rehabilitation facility, and whose probation is thereafter revoked, will only have earned credit for time actually served and not conduct credit. From this fact it might reasonably be inferred that the Legislature has already weighed the factors cited by the court below and has concluded as a general rule that the public interest would best be served by a reduction in credit for time spent in nonpenal institutions, not a complete disallowance. It simply is not within judicial competence to categorically reject such a legislative policy determination out of simple disagreement with it.
Furthermore, as defense counsel pointed out, the trial court's rationale possesses no discernible force as applied to defendants who successfully complete a program: the court's avowed goal of encouraging completion would appear to be served more effectively by holding out the carrot of restored credit upon completion than by applying only the bludgeon of a flat, blanket denial. Curiously, the court expressed agreement with this reasoning, but nonetheless refused to consider any modification to its "standard practice."[5]
(4) Ordinarily, of course, a trial court's reasons for ruling in a particular manner are not reviewable on appeal. (9 Witkin, Cal. Procedure (3d ed. 1985) Appeal, § 259, p. 266.) An exception is made, however, when the *306 court's comments unambiguously disclose that it failed to pass on the merits of the issue (id. at § 262, p. 269), or that its ruling embodied, or rested upon, a misunderstanding of the relevant law (In re Jerry R. (1994) 29 Cal. App.4th 1432, 1440 [35 Cal. Rptr.2d 155], review den.) or an arbitrary or irrational point of view (9 Witkin, op. cit. supra, § 262, p. 270, citing Wirz v. Wirz (1950) 96 Cal. App.2d 171, 176 [214 P.2d 839, 15 A.L.R.2d 1129] [trial court's stated disapproval of statutory objective did not justify finding contrary to uncontradicted expert testimony]). (3b) Here the court's comments betray a refusal to apply the relevant statute out of a categorical preference for its own policy analysis. Though the distinguished trial judge's preference was considered and in good faith, he should not have permitted his view to supersede that of the Legislature.[6]
Failure to exercise a discretion conferred and compelled by law constitutes a denial of a fair hearing and a deprivation of fundamental procedural rights, and thus requires reversal. (In re Ronnie P. (1992) 10 Cal. App.4th 1079, 1091 [12 Cal. Rptr.2d 875], review den.; see In re Geronimo M. (1985) 166 Cal. App.3d 573, 587-588 [212 Cal. Rptr. 532] [Youth Authority commitment circumventing statutory procedures was prejudicial notwithstanding contention that appellant would have been committed under proper procedures]; In re Willie T. (1977) 71 Cal. App.3d 345, 353-354 [139 Cal. Rptr. 439] [extrastatutory procedure by which minor was placed on probation and probation was revoked was prejudicial because it modified a prior disposition to minor's detriment without complying with statutory requirements]; Reifler v. Superior Court (1974) 39 Cal. App.3d 479, 485 [114 Cal. Rptr. 356] [refusal to exercise discretion required by law to be exercised required remand for that purpose]; In re Michael G. (1977) 76 Cal. App.3d 872, 875 [143 Cal. Rptr. 163] [failure to exercise discretion].) Accordingly, the order granting probation will be set aside and remanded for reconsideration of the condition requiring a prospective waiver of credits for time served in a residential rehabilitation facility.


*307 II.
(5) Defendant's sentencing memorandum also challenged the proposed conditions of probation insofar as they granted authority to the probation department to unilaterally select a residential drug rehabilitation program and determine whether defendant successfully completed that program. Defendant contended that such an order effected an unlawful delegation of judicial authority.
Several cases have found excessive delegations of authority in orders which resemble, at least superficially, the one challenged here. (People v. Cervantes, supra, 154 Cal. App.3d 353, 356-357, 361 [probation officer to determine propriety, amount, and manner of restitution to be paid]; In re Shawna M. (1993) 19 Cal. App.4th 1686, 1690-1691 [24 Cal. Rptr.2d 126] [juvenile court delegated excessive authority over parental visitation to a county child welfare agency]; In re Debra A. (1975) 48 Cal. App.3d 327, 330 [121 Cal. Rptr. 757] [juvenile court could not delegate to probation officer discretion to determine place of a series of detentions]; In re Marriage of Matthews (1980) 101 Cal. App.3d 811, 816-817 [161 Cal. Rptr. 879] [two improper delegations of authority: (1) to a counselor to alter existing visitation orders as she deemed proper; and (2) to a therapist to issue various "directive[s]" with which a parent was required to comply.)
On close examination, however, none of these cases furnishes compelling authority for invalidating the condition challenged here. In the first three, the probation officer could reasonably be required to provide the court with a specific recommendation around which any challenge might form and upon which the court could act. In the fourth (Matthews), authority was delegated to persons outside the judicial system, empowering them to issue binding directives across a seemingly unlimited range of personal matters  directives which might well inflict significant hardship while in effect, but which might be sufficiently ephemeral to evade judicial review. Moreover, two of the cited cases involved not conditions of probation, as understood in adult criminal law, but the imposition of dispositional orders in juvenile proceedings. This court has previously noted major conceptual distinctions between such orders and the conditions of probation imposed in adult criminal cases. (In re Ronnie P., supra, 10 Cal. App.4th at p. 1089; In re Bernardino S. (1992) 4 Cal. App.4th 613, 622, fn. 5 [5 Cal. Rptr.2d 746].) An even greater conceptual distance separates this case from Matthews, which involved an order by the family law court. Only Cervantes involved an adult probation condition, and there the trial court sought to delegate a determination which was explicitly assigned to it by statute. (People v. Cervantes, supra, 154 Cal. App.3d at pp. 356-358.)
*308 Here, as conceded by the defense, any attempt to specify a particular program at or prior to sentencing would pose serious practical difficulties. The trial court is poorly equipped to micromanage selection of a program, both because it lacks the ability to remain apprised of currently available programs and, more fundamentally, because entry into a particular program may depend on mercurial questions of timing and availability. The specified program may decline to accept the defendant, for instance, or may be unable to do so for reasons as mundane as lack of space.
We acknowledge defense counsel's point that certain compromise schemes might do much to narrow the authority delegated to probation officers without imposing an undue burden on trial courts. Counsel suggested, for instance, that the court develop a system for rating available programs by intensity of treatment, with the probation order specifying an appropriate "level." The court itself noted the possibility of specifying a maximum program duration. Another alternative might be the practice, followed in at least some probation departments, of identifying several suitable programs in the probation report, and seeking a probation order permitting the defendant's placement in any of the named programs. This approach places the burden of specification on the probation officer, who presumably has the time and expertise to most efficiently carry it; it provides the defense an opportunity to raise objections to particular programs at or before the sentencing hearing; and it reserves to the court its ultimate authority over the issue.
Desirable as such a narrowing of the probation officer's discretion might be, however, we are not prepared at this time to hold that its absence constitutes prejudicial error. Our attention is drawn to no statutes which, like the statutes in Cervantes, explicitly require the court to make the determination. Nor does the delegation here in issue place the defendant completely at the mercy of the probation department. A defendant who is concerned about particular risks can bring those concerns to the court's attention at or prior to sentencing, asking it (for instance) to approve or disapprove specific programs identified by the defense. Failing that, the defendant can seek judicial intervention  by moving to modify the probation order, if nothing else  if and when the probation officer seeks to exercise the delegated authority. (See § 1203.3.) We decline to hold, on this record, that such remedies are insufficient or that the delegation of authority to select a program was otherwise erroneous.
(6) Defendant also objected to the challenged condition on the ground that it delegated to the probation officer the authority to determine whether defendant had successfully completed the selected program. It appears, however, that the condition was, to the extent it purported to have this effect, *309 practically meaningless. Should the probation officer make a determination favorable to defendant, defendant will suffer no legal injury. An unfavorable determination, on the other hand, will be inherently subject to judicial review. That is, if the probation officer concludes that the defendant has not successfully completed the program, he or she must bring the matter to the court's attention by petition to revoke, extend, or modify probation. (See § 1203.2, subd. (a).) Failure to do so within the probationary period (see § 1203, subd. (a)), deprives the court of power to inflict any adverse consequences upon the defendant for the putative failure to fulfill the condition. (§ 1203.3, subd. (a).) If proceedings are instituted, the defendant may challenge the probation officer's interpretation of the facts  in this instance, the conclusion that the defendant has not successfully completed the program.[7] If the court in such proceedings gives undue deference to the probation officer's "determination," the concerns expressed here by defendant will be crystallized on the record and would be subject to appellate review.
Defendant also argued that the treatment condition was impermissibly vague in that it did not sufficiently apprise defendant of the burdens she was assuming by accepting the condition, and did not sufficiently fix a standard by which to determine whether she had satisfied the condition. Citing People v. Hernandez (1991) 226 Cal. App.3d 1374, 1380-1381 [277 Cal. Rptr. 444] (disapproved on another point in People v. Welch (1993) 5 Cal.4th 228, 237 [19 Cal. Rptr.2d 520, 851 P.2d 802]), and People v. Reinertson (1986) 178 Cal. App.3d 320, 324-325 [223 Cal. Rptr. 670] (review den.), she asserted that no prospective probationer "can knowingly consent to such a broad term, having no idea of the commitment he or she is making." She continued, "A defendant has a right to more specific guidelines from the court as to the scope of the proposed program in order for the defendant to intelligently consider his or her options, argue the scope of his obligations under the order, address whether the proposed term of probation is reasonable in relationship to the offense committed, as well as to have sufficient definition of his or her rights and responsibilities under the probation order."
While this argument may possess some abstract appeal, it appears that defense counsel here was amply familiar with the range of possibilities to which defendant was exposed. He asserted that available programs ranged from "a ten-day detoxification period to a two-year program of behavioral modification." Therefore counsel, if not his client, knew that agreement to this condition entailed a potential restraint of up to two years. The second *310 point  ability to ascertain compliance  raises a more difficult theoretical question, but appears to founder upon the fact already noted  that the ultimate determination of compliance must necessarily be made by the court, at which time any undue deference to the probation officer's opinion may be challenged and, if necessary, appealed. (See § 1203.3; but see People v. Hodgkin, supra, 194 Cal. App.3d at p. 805 [argument that defendant could seek modification of onerous condition was "accurate but unpersuasive when the condition itself is unreasonable in the first instance"].)
We conclude that no prejudicial error appears in the court's refusal to specify, or more narrowly define, the drug program in which defendant would be placed, or in the ostensible delegation of the power to determine whether defendant has successfully completed such a program.
The order granting probation is reversed for reconsideration of the condition requiring a waiver of credit for time served in a rehabilitation program. In all other respects the judgment is affirmed.
Lambden, J., and Hitchens, J.,[*] concurred.
NOTES
[1]  Unless otherwise indicated, all statutory references are to the Penal Code.
[2]  Defendant's acceptance of the conditions of probation did not preclude her challenging them on appeal. "[I]t is established that if a defendant accepts probation, he may seek relief from the restraint of an allegedly invalid condition of probation on appeal from the order granting probation. (In re Bushman (1970) 1 Cal.3d 767, 776 [83 Cal. Rptr. 375, 463 P.2d 727] [disapproved on another point in People v. Lent (1975) 15 Cal.3d 481, 486, fn. 1 (124 Cal. Rptr. 905, 541 P.2d 545)].)" (People v. Cervantes (1984) 154 Cal. App.3d 353, 361 [201 Cal. Rptr. 187)].)
[3]  "In all felony and misdemeanor convictions, ... when the defendant has been in custody, including, but not limited to, any time spent in a ... rehabilitation facility ... [or] similar residential institution, ... all days of custody of the defendant, including days served as a condition of probation in compliance with a court order, and including days credited to the period of confinement pursuant to Section 4019, shall be credited upon his or her term of imprisonment...." (§ 2900.5, subd. (a).)
[4]  Of course dropping out of the program could be treated as a violation of probation, permitting the court to make appropriate orders, including modifications to the conditions of probation. For example, the court might impose a longer jail term, requiring at that time that the defendant waive credit for the time spent unsuccessfully in the rehabilitation program. And the court might make it clear ahead of time that this would be its likely disposition if the defendant failed to complete the program. Such an approach would seem superior in several respects to relying on a "standard practice" without regard to individual circumstances  particularly one which flatly contravenes statutory policy.
[5]  "MR. RAPHAEL: I would submit, your Honor, that if the court had a consistent practice where one was given time credits for days spent in a program only if they successfully completed the program, and if they did not successfully complete the program they agreed to waive any time credits for time spent in the program, that that would more closely comport with 2900.5 although not specifically but it's closer to.

"I can see the public policy argument behind that type of situation, but a complete denial of time credits on a routine basis I really, I don't see as really comporting with either public policy or a legislative mandate.
"THE COURT: I agree with what you just said; however, that doesn't mean that I am going to change what I do unless I get a clear directive from a court that what I'm doing is outside the legitimate bounds of the exercise of my discretion because I think my reasons are better than the [L]egislature's reasons. As long as I believe I have the legal power to act on mine I'm going to do it.
"All I can tell you is is [sic] I thought this through a whole lot of times, and I'm not doing it in order to be heavy or to penalize people. I'm doing it because I think it sends them off with a better attitude toward why they're in the program and a higher likelihood of success."
[6]  We need not decide whether the court's ruling also invaded the province of the Legislature in violation of the constitutional separation of powers. While the imposition of sentence and concomitant exercise of sentencing discretion are judicial functions, it is emphatically the role of the Legislature, within constitutional limits, to define offenses and prescribe punishments. (People v. Navarro (1972) 7 Cal.3d 248, 258 [102 Cal. Rptr. 137, 497 P.2d 481]; see People v. Karsai (1982) 131 Cal. App.3d 224, 241 [182 Cal. Rptr. 406], disapproved on another point in People v. Jones (1988) 46 Cal.3d 585, 600, fn. 8 [250 Cal. Rptr. 635, 758 P.2d 1165]; People v. Riolo (1983) 33 Cal.3d 223, 229 [188 Cal. Rptr. 371, 655 P.2d 723].) In the absence of constitutional infirmity, whether a sentencing law is "wise" is a question of public policy for the Legislature, not the courts. (People v. Sipe (1995) 36 Cal. App.4th 468, 483 [42 Cal. Rptr.2d 266], review den.) A court which substitutes its own blanket policy judgment for a contrary legislative judgment arguably usurps that body's office. The ruling before us constituted reversible error, however, whether or not it violated the separation of powers.
[7]  Even if the probation officer takes no action, the defendant can seek to avert any adverse consequences by petitioning the court to dismiss the probation as successfully completed. (§ 1203.4.)
[*]   Judge of the San Francisco Superior Court, assigned by the Chief Justice pursuant to article VI, section 6, of the California Constitution.
