On three separate days this July, invisible and odorless gases will be released in subway stations and at street level in all five boroughs of New York City. But officials in the New York Police Department will not be alarmed — it was their idea.

The gases, known as perfluorocarbons, will be dispersed to study how airborne toxins would flow through the city after a terrorist attack or an accidental spill of hazardous chemicals, the department said on Wednesday.

Researchers supervised by the Brookhaven National Laboratory will use about 200 monitors to trace the paths of the gases they release. The police intend to use the information gathered in the test, which they said would be the biggest such urban airflow study, to hone their plans for emergency responses.

One answer they seek is how the subway system affects the flow of air above and below ground. Knowing that will help them decide which subway lines may have to be shut down to limit the spread of hazardous material, said Paul Kalb, division head for environmental research and technology in the environmental sciences department at Brookhaven National Laboratory.