As you are well aware, the state of California has grown concerned about smog, particularly in Southern California. In response they set limits as to the amount of pollutants that a car can emit and still be licensed. Hence the requirement to periodically take your car to an inspection station and have its exhaust analyzed.
However, our government friends determined that these stations could not economically test the car in all operating modes, so they forced car manufacturers to put in sensors that measure pollutants at speeds and operating conditions that the inspection stations can't observe. These sensors connect to an onboard computer which stores their results; probably average values for a past period of time, or perhaps the latest values.
This computer is an electronic device and needs electrical power to maintain its memory. Normally that's not a problem as the car's battery provides more than enough power. But you had the battery replaced which momentarily deprived the computer of power and wiped its memory clean. This would also not normally be a problem, but the sensors aren't active at all times. Some apparently only work in specific driving regimes (e.g. speeds above 55 mph). Still not a problem normally because after a day or so of driving, all of those regimes should have been experienced, the sensors reactivated, and the computer updated with data. Only neither the State of California, nor the automobile manufacturers, anticipated granny driving during which the car never exceeds 25 MPH (except on La Jolla Boulevard, where speeds have been observed which, by all rights, should have activated the sensors).
The day after you berated the poor service station guys for not being willing to violate state law, I took the car for a spin up Highway 52 and drove it around near Convoy at various speeds. This was apparently sufficient to re-enable all the sensors and cause them to once again report data to the on-board computer. The next morning the car was issued its anti-smog certificate with no problems.