There are however federal laws that supersede California laws regarding drug use. Use of cannabis etc. may be legal in many states but it is not at the federal level. An individual who is certified or licenses to work on US flagged merchant ships can lose his or her merchant marine documents and license if she or he tests positive for cannabis etc.
There’s an idea. Put all of CA on cargo ships and don’t let them dock.