A new federal law will change how doctors get paid in California, making it easier for patients in 14 California counties to find a doctor who accepts Medicare.

The law, signed by President Obama on Tuesday night, fixes an outdated Medicare formula that set rates based on urban or rural designations established in the 1960s, with places like San Diego, Sacramento, and Santa Cruz falling into the “rural” category.

So even as rent for office space and other costs of practicing medicine rose with the local economy in those places, doctors were still paid the same rates as doctors in remote, rural areas like Humboldt or Modoc.

At those rates, doctors said they couldn't afford to treat Medicare patients.

“It was a dry spell,” said Dr. Larry DeGhetaldi, a family physician in Santa Cruz. In the mid-2000s, his medical group had to turn patients away for years because they couldn't recruit enough doctors. He watched medical school graduates set up shop in neighboring Silicon Valley instead, where they could get paid 25 percent more.