Skip to content

Commit

Permalink
release: version 0.1.11
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Complete overhaul from v0.1.9.0 to v0.1.11

Major Changes:
- Complete overhaul of RawDataReader module with improved architecture
- Migration from setup.py to pyproject.toml for modern Python packaging
- Removal of deprecated AeroViz.process directory

Features & Improvements:
1. RawDataReader Enhancements:
   - Improved file handling with proper resource management
   - Added robust error handling for missing data
   - Optimized data processing performance
   - Enhanced logging system with proper file closure
   - Updated data validation logic
   - Added support for new data formats
   - Set SMPS default size range (11.8, 593.5)
   - Added kwargs for customizable size range

2. Project Infrastructure:
   - Migrated to pyproject.toml for package configuration
   - Enhanced test coverage configuration and reporting
   - Optimized CI/CD pipeline
   - Updated GitHub Actions workflows for PyPI publishing
   - Centralized dependencies management
   - Improved package data handling

3. Visualization & Logging:
   - Enhanced progress bar visualization
   - Optimized ANSI support for Windows
   - Added new HYSPLIT plotting method
   - Improved VOC processing

4. Documentation:
   - Updated project documentation
   - Improved code syntax and structure
   - Added comprehensive test coverage documentation

This release represents a significant upgrade focusing on performance,
reliability, and maintainability of the AeroViz package.
  • Loading branch information
Alex870521 committed Nov 7, 2024
1 parent 5bda1ad commit ed7ed88
Show file tree
Hide file tree
Showing 180 changed files with 10,138 additions and 9,419 deletions.
103 changes: 103 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# .github/workflows/cleanup.yml
name: Repository Cleanup

on:
workflow_dispatch:
inputs:
action_type:
description: '選擇要執行的操作'
required: true
type: choice
options:
- 'Cleanup Workflow'
- 'Cleanup Deployments'
workflow_status:
description: '要清理的工作流程狀態 (僅在選擇 Cleanup Workflow 時需要)'
required: false
type: choice
options:
- 'disabled' # 已停用的工作流程
- 'active' # 活躍的工作流程
- 'all' # 所有工作流程
environment:
description: '要清理的部署環境 (僅在選擇 Cleanup Deployments 時需要)'
required: false
type: choice
options:
- 'all'
- 'github-pages'
- 'pypi'

jobs:
cleanup-workflows:
if: ${{ github.event.inputs.action_type == 'Cleanup Workflow' }}
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Cleanup workflows
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const status = '${{ github.event.inputs.workflow_status }}';
console.log(`Cleaning up workflows with status: ${status}`);
// 獲取所有工作流程
const workflows = await github.rest.actions.listRepoWorkflows({
owner: context.repo.owner,
repo: context.repo.repo
});
for (const workflow of workflows.data.workflows) {
// 根據選擇的狀態過濾工作流程
if (status === 'all' ||
(status === 'disabled' && !workflow.state === 'active') ||
(status === 'active' && workflow.state === 'active')) {
console.log(`Processing workflow: ${workflow.name} (${workflow.state})`);
// 獲取此工作流程的所有運行
const runs = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflow.id,
});
// 刪除運行
console.log(`Found ${runs.data.total_count} runs to delete`);
for (const run of runs.data.workflow_runs) {
console.log(`Deleting run #${run.run_number} of ${workflow.name}`);
await github.rest.actions.deleteWorkflowRun({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: run.id
});
}
}
}
console.log('Cleanup completed');
cleanup-deployments:
if: ${{ github.event.inputs.action_type == 'Cleanup Deployments' }}
runs-on: ubuntu-latest
permissions:
deployments: write
actions: write
contents: write
steps:
- name: Delete github-pages deployments
if: ${{ github.event.inputs.environment == 'github-pages' || github.event.inputs.environment == 'all' }}
uses: strumwolf/delete-deployment-environment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: github-pages
onlyRemoveDeployments: true

- name: Delete pypi deployments
if: ${{ github.event.inputs.environment == 'pypi' || github.event.inputs.environment == 'all' }}
uses: strumwolf/delete-deployment-environment@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: pypi
onlyRemoveDeployments: true
135 changes: 135 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Publish AeroViz

on:
push:
tags:
- 'v*'

jobs:
build-and-test:
strategy:
matrix:
python-version: [ "3.11", "3.12" ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel build
pip install -e .
pip install -e ".[test]"
- name: Run tests
run: |
pytest tests/ -m "not requires_data"
- name: Verify package version matches tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PACKAGE_VERSION=$(python setup.py --version)
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch:"
echo " - Tag version: $TAG_VERSION"
echo " - Package version: $PACKAGE_VERSION"
exit 1
else
echo "Version match: $TAG_VERSION"
fi
- name: Build package
run: python -m build

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-${{ matrix.python-version }}
path: dist/

publish-test:
needs: build-and-test
runs-on: ubuntu-latest
environment:
name: test-pypi
url: https://test.pypi.org/p/AeroViz
permissions:
id-token: write

steps:
# Download artifacts from Python 3.12 build only
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions-3.12
path: dist/

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

publish-prod:
needs: publish-test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/AeroViz
permissions:
id-token: write

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions-3.12
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Create GitHub Release
needs: publish-prod
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: python-package-distributions-3.12
path: dist/

- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes "Release ${{ github.ref_name }}"
- name: Upload artifacts to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
49 changes: 49 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Python Tests

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
strategy:
matrix:
python-version: [ "3.11", "3.12" ]
os: [ ubuntu-latest ]

fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python 3.XX
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # 啟用 pip 緩存加速安裝

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .
pip install -e ".[test]"
- name: Run tests with coverage
run: |
pytest tests/ -m "not requires_data" \
--cov=AeroViz \
--cov-report=term-missing \
--cov-report=xml \
-v
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}-${{ github.sha }}
path: coverage.xml
if-no-files-found: error
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
#

# MacOX product
.DS_store
tests/
temp/
example/

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -35,7 +32,7 @@ share/python-wheels/
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a templates
# Usually these files are written by a python script from a data
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
Expand Down Expand Up @@ -161,7 +158,7 @@ dmypy.json
cython_debug/

# PyCharm
# JetBrains specific templates is maintained in a separate JetBrains.gitignore that can
# JetBrains specific data is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
Expand Down
13 changes: 7 additions & 6 deletions AeroViz/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# This file is used to import all the modules in the AeroViz package
from AeroViz import plot
from AeroViz.dataProcess import Optical, SizeDistr, Chemistry, VOC
from AeroViz.dataProcess import DataProcess
from AeroViz.rawDataReader import RawDataReader
from AeroViz.tools import DataBase, DataReader, DataClassifier
from AeroViz.tools import DataBase, DataClassifier

__all__ = [
'plot',
'RawDataReader',
'Optical', 'SizeDistr', 'Chemistry', 'VOC',
'DataBase', 'DataReader', 'DataClassifier'
'plot',
'RawDataReader',
'DataProcess',
'DataBase',
'DataClassifier'
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Time,SO2,NO,NOx,NO2,CO,O3,THC,CH4,NMHC,PM10,PM25,WS,WD,AT,RH,RT,Benzene,Toluene,EthylBenzene,m/p-Xylene,o-Xylene,Si,Ti,V,Cr,Mn,Fe,Co,Ni,Cu,Zn,Ga,As,Se,Br,Sr,Ag,Cd,Sn,Sb,Ba,Hg,Tl,Pb,NH3,HF,HCl,HNO2,HNO3,G-SO2,Na+,NH4+,K+,Mg2+,Ca2+,F-,Cl-,NO2-,NO3-,PO43-,SO42-,Extinction,Scattering,Absorption,MEE,MSE,MAE,SSA,SAE450700,AAE370880,Vis_Naked,Vis_LPV,BC,VC,PBLH,T_OC,T_EC,O_OC,O_EC,POC,SOC,NOR,SOR,PM1,ALWC,pH,NH4_status,AS,AN,OM,Soil,SS,EC,SIA,total_mass,unknown_mass,AS_ratio,AN_ratio,OM_ratio,Soil_ratio,SS_ratio,EC_ratio,SIA_ratio,unknown_mass_ratio,AS_volume,AN_volume,OM_volume,Soil_volume,SS_volume,EC_volume,total_volume,AS_volume_ratio,AN_volume_ratio,OM_volume_ratio,Soil_volume_ratio,SS_volume_ratio,EC_volume_ratio,density,ALWC_volume_ratio,gRH,k_amb,k_dry,kappa_chem,kappa_vam,n_amb,n_dry,AS_ext_dry,AN_ext_dry,OM_ext_dry,Soil_ext_dry,SS_ext_dry,EC_ext_dry,total_ext_dry,AS_ext,AN_ext,OM_ext,Soil_ext,SS_ext,EC_ext,total_ext,ALWC_AS_ext,ALWC_AN_ext,ALWC_SS_ext,ALWC_ext,fRH_IMPR,ScatteringByGas,AbsorptionByGas,ExtinctionByGas,Number,GMDn,GSDn,mode_n,ultra_n,accum_n,coarse_n,Surface,GMDs,GSDs,mode_s,ultra_s,accum_s,coarse_s,Volume,GMDv,GSDv,mode_v,ultra_v,accum_v,coarse_v,Bext_internal,GMDext_in,GSDext_in,mode_ext_in,ultra_ext_in,accum_ext_in,coarse_ext_in,Bsca_internal,Babs_internal,Bext_external,GMDext_ex,GSDext_ex,mode_ext_ex,ultra_ext_ex,accum_ext_ex,coarse_ext_ex,Bsca_external,Babs_external,Bext_Fixed_PNSD,Bext_Fixed_RI,PG,MAC,Ox,N2O5_tracer,Vis_cal,OCEC_ratio,PM1/PM25,MEE_PNSD
Time,SO2,NO,NOx,NO2,CO,O3,THC,CH4,NMHC,PM10,PM2.5,WS,WD,AT,RH,RT,Benzene,Toluene,EthylBenzene,m/p-Xylene,o-Xylene,Si,Ti,V,Cr,Mn,Fe,Co,Ni,Cu,Zn,Ga,As,Se,Br,Sr,Ag,Cd,Sn,Sb,Ba,Hg,Tl,Pb,NH3,HF,HCl,HNO2,HNO3,G-SO2,Na+,NH4+,K+,Mg2+,Ca2+,F-,Cl-,NO2-,NO3-,PO43-,SO42-,Extinction,Scattering,Absorption,MEE,MSE,MAE,SSA,SAE450700,AAE370880,Vis_Naked,Vis_LPV,BC,VC,PBLH,T_OC,T_EC,O_OC,O_EC,POC,SOC,NOR,SOR,PM1,ALWC,pH,NH4_status,AS,AN,OM,Soil,SS,EC,SIA,total_mass,unknown_mass,AS_ratio,AN_ratio,OM_ratio,Soil_ratio,SS_ratio,EC_ratio,SIA_ratio,unknown_mass_ratio,AS_volume,AN_volume,OM_volume,Soil_volume,SS_volume,EC_volume,total_volume,AS_volume_ratio,AN_volume_ratio,OM_volume_ratio,Soil_volume_ratio,SS_volume_ratio,EC_volume_ratio,density,ALWC_volume_ratio,gRH,k_amb,k_dry,kappa_chem,kappa_vam,n_amb,n_dry,AS_ext_dry,AN_ext_dry,OM_ext_dry,Soil_ext_dry,SS_ext_dry,EC_ext_dry,total_ext_dry,AS_ext,AN_ext,OM_ext,Soil_ext,SS_ext,EC_ext,total_ext,ALWC_AS_ext,ALWC_AN_ext,ALWC_SS_ext,ALWC_ext,fRH_IMPR,ScatteringByGas,AbsorptionByGas,ExtinctionByGas,Number,GMDn,GSDn,mode_n,ultra_n,accum_n,coarse_n,Surface,GMDs,GSDs,mode_s,ultra_s,accum_s,coarse_s,Volume,GMDv,GSDv,mode_v,ultra_v,accum_v,coarse_v,Bext_internal,GMDext_in,GSDext_in,mode_ext_in,ultra_ext_in,accum_ext_in,coarse_ext_in,Bsca_internal,Babs_internal,Bext_external,GMDext_ex,GSDext_ex,mode_ext_ex,ultra_ext_ex,accum_ext_ex,coarse_ext_ex,Bsca_external,Babs_external,Bext_Fixed_PNSD,Bext_Fixed_RI,PG,MAC,Ox,N2O5_tracer,Vis_cal,OCEC_ratio,PM1/PM25,MEE_PNSD
2021-02-01 00:00:00,2.5,10.4,53.0,42.6,1.3,14.6,2.2,2.0,0.2,84.0,56.0,1.3,306.0,20.5,76.8,24.4,0.99,2.67,0.19,0.68,0.21,,,,,,,,,,,,,,,,,,,,,,,,12.5774,,0.5693,0.4759,,0.0714,0.4765,11.6625,0.0743,0.2798,0.2885,,0.1486,0.5551,6.4869,,2.9681,179.879,129.306,50.573,3.212125969,2.309035714,0.903090254,0.718849677,1.624,1.356,,2.4,3593.466667,48.54,37.339,0.540278143,0.169467395,,,7.108993122,2.413756878,0.056,0.229,35.56,15.537361,3.88663594,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11.3805792163543,14.058,25.4385792163544,65073.8724853036,26.1370756001682,2.27387008559594,11.8,0.9,0.1,0.0,1056999978.60697,202.561522810954,2.46787275826095,175.1255164,0.17,0.8,0.03,51861790000.2695,421.511551165032,2.3298013391531,378.4899973,0.03,0.8,0.16,,,,,,,,,,,,,,,,,,,,,205.317579216354,298.423186359831,57.2,621.96,6.09298472862313,,0.635,
2021-02-01 01:00:00,2.1,1.8,36.7,34.8,0.9,21.1,2.2,2.1,0.1,73.0,49.0,1.2,291.0,19.7,80.5,24.4,1.14,1.84,0.12,0.43,0.11,,,,,,,,,,,,,,,,,,,,,,,,12.0403,,0.5965,0.3095,,0.0355,0.4456,11.057,0.0568,0.284,0.2534,,0.1092,0.2621,5.8583,,2.8003,162.183,120.322,41.861,3.309852291,2.45555102,0.854301271,0.741891421,1.668,1.285,10.0,2.4,3008.316667,50.13,41.775,0.466460746,0.148629793,,,6.036647232,1.923627768,0.061,0.25,32.2,18.378917,3.919787846,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11.4116843184148,11.484,22.8956843184148,42275.3347651561,32.3417554250119,2.43890896537368,11.8,0.85,0.15,0.0,979132241.788556,213.495369564376,2.34216600590469,192.8357499,0.16,0.81,0.03,49066097131.0516,420.683242663998,2.27756054854188,378.4899973,0.03,0.81,0.15,,,,,,,,,,,,,,,,,,,,,185.078684318415,281.646089623498,55.9,734.28,6.75779828958646,,0.657142857142857,
2021-02-01 02:00:00,2.9,9.8,61.0,51.1,0.99,10.7,2.4,2.1,0.3,94.0,70.0,1.3,299.0,19.4,82.8,24.4,1.08,1.98,0.14,0.14,0.12,0.479322,0.013841,0.001037,0.002118,0.026962,0.49815,,,0.039141,0.140642,,0.008099,0.003098,0.023387,,,,0.018278,0.011566,0.005437,,,0.009238,12.0026,,0.3118,0.2484,,0.0514,0.424,12.8777,0.0656,0.2885,0.2404,,0.1137,0.4371,8.3928,,2.7932,208.59,158.844,49.746,2.979859428,2.2692,0.710659428,0.761512432,1.75,1.31,,2.55,3570.75,58.135,44.719,0.624357056,0.20177276,,,7.06735645,2.12126855,0.06,0.194,34.93,24.048226,3.879511152,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,11.4233926128591,16.863,28.2863926128591,62303.8712944327,30.3238605222433,2.49086526854534,11.8,0.85,0.15,0.0,1391459557.50536,211.541054105552,2.30001297386085,186.741787,0.15,0.82,0.02,67916033048.9499,402.359688194295,2.22606883392695,366.5290201,0.03,0.84,0.13,,,,,,,,,,,,,,,,,,,,,236.876392612859,246.544677289442,61.8,546.77,5.25432666954312,,0.499,
Expand Down
File renamed without changes.
Loading

0 comments on commit ed7ed88

Please sign in to comment.