Abstract. More attention has been paid to the air pollution caused by ship emissions; hence the establishment of accurate emission inventories is an important means to assess the impact on the environment and human beings. The emission factor is an important parameter in the process of compiling the ship emission inventory, yet there is some uncertainty in its estimation based on the sniffer method. In this study, taking the calculation of SO2 emission factors as an example and aiming at the selection of gas measurement values using the sniffer method, the concept of standard deviation of peak density was proposed to determine the optimal integral interval length of the measured values of SO2 and CO2. Then, the improved Manhattan distance was used to characterize the position of the peak points in the SO2 and CO2 average series. Using the dynamic time warping algorithm, the corresponding relationship of the peak points in the average series of the measured gases was determined, and the global optimal peak points were selected from it. To evaluate the credibility of calculated emission factors, 16 evaluation indexes that reflect the characteristics of the measured data were selected. The confidence interval of 95 % of each evaluation index was calculated using self-development sampling of the measured data, and the evaluation result of the evaluation index for the quality of the measured data was obtained. Combined with the data quality label, the indexes with high correct rate were screened. Finally, the evaluation scores were determined according to these selected indexes. We collected a total of 148 sets of "SO2+CO2" measurement data between 2019 and 2021 using the unmanned aerial vehicle sniffing monitoring system in the Waigaoqiao Port area of Shanghai, China for verification using the method proposed in this study. The results show that for this data set, 12 s is the most suitable integral length, with which the algorithm can automatically calculate the emission factor. The screening results of the global optimal peak points of 129 groups of data are consistent with those of artificial screening, with a correct rate of 87.16 %. The accuracy of the combined evaluation of sample entropy (SO2), information entropy (SO2), skewness (CO2) and quartile spacing (SO2) is 71 %. Previous calculation of the emission factor of ships mainly focused on different conditions such as time, region, fuel, engine, ship type, and navigation status. Our in-depth study proposes a high accuracy ship emission factors calculation method and an evaluation of the quality of the measurement data that reduces uncertainty in the current sniffer technique monitoring ship emission research.