Cavity and ground effects on a superconducting microstrip resonator