A state - even a BLUE state (yes, the law applies to them as well, even if they don't think so) - cannot write a law which supersedes federal law. So California cannot write a law which prevents FEDERAL officers from making arrests ANYWHERE in the state.
There is a very simple way to remember this - states can TOUGHEN federal law, but they cannot LOOSEN federal law. Hypothetical Example: federal law allows 0.10% blood alcohol before reaching DUI level. A state can LOWER that to any amount below 0.10% blood alcohol, but cannot raise the level to HIGHER than 0.10% blood alcohol level.
So states can "legalize" marijuana for STATE law enforcement purposes, but cannot make it FEDERALLY legal. Meaning the Feds CAN make marijuana-related arrests - even in "legalized" states.