Skip to content

Commit 9a3be6e

Browse files
authored
Merge pull request #26 from pradal/namespace
Move alinea to namespace package
2 parents 0ee5546 + 3e675f4 commit 9a3be6e

File tree

5 files changed

+18
-84
lines changed

5 files changed

+18
-84
lines changed

.github/workflows/conda-package-build.yml

+11-61
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,16 @@ name: build_publish_anaconda
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches:
6+
- '**'
7+
tags:
8+
- 'v*'
69
pull_request:
7-
branches: [ master ]
8-
9-
jobs:
10-
build-and-publish:
11-
name: ${{ matrix.os }}, Python 3.${{ matrix.python-minor-version }} for conda deployment
12-
runs-on: ${{ matrix.os }}
13-
strategy:
14-
fail-fast: false
15-
max-parallel: 3
16-
matrix:
17-
os: [ubuntu-latest]
18-
python-minor-version: [9]
19-
isMaster:
20-
- ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/dev') }}
21-
exclude:
22-
- isMaster: false
23-
os: ubuntu-latest
24-
python-minor-version: 7
25-
- isMaster: false
26-
os: ubuntu-latest
27-
python-minor-version: 8
28-
- isMaster: false
29-
os: macos-latest
30-
python-minor-version: 7
31-
- isMaster: false
32-
os: macos-latest
33-
python-minor-version: 8
34-
- isMaster: false
35-
os: macos-latest
36-
python-minor-version: 9
37-
- isMaster: false
38-
os: windows-latest
39-
python-minor-version: 7
40-
- isMaster: false
41-
os: windows-latest
42-
python-minor-version: 8
43-
- isMaster: false
44-
os: windows-latest
45-
python-minor-version: 9
10+
branches:
11+
- '**'
4612

47-
steps:
48-
- name: Chekout
49-
uses: actions/checkout@v3
50-
- name: Determine publish
51-
uses: haya14busa/action-cond@v1
52-
id: publish
53-
with:
54-
cond: ${{ contains(github.ref, 'master') || startsWith(github.ref, 'refs/heads/v') }}
55-
if_true: 'true'
56-
if_false: 'false'
57-
- name: Build and Publish
58-
uses: openalea/action-build-publish-anaconda@v0.1.3
59-
with:
60-
conda: conda
61-
mamba: true
62-
python: ${{ matrix.python-minor-version }}
63-
numpy: '20.0'
64-
channels: openalea3, conda-forge
65-
token: ${{ secrets.ANACONDA_TOKEN }}
66-
publish: ${{ steps.publish.outputs.value }}
67-
label: main
13+
jobs:
14+
build:
15+
uses: openalea/github-action-conda-build/.github/workflows/conda-package-build.yml@main
16+
secrets:
17+
anaconda_token: ${{ secrets.ANACONDA_TOKEN }}

setup.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from os.path import abspath, normpath
99
from os.path import join as pj
1010

11-
from setuptools import setup, find_packages
11+
from setuptools import setup, find_namespace_packages
1212

1313

1414
short_descr = "The Alinea.astk package provides utilities for simulation of FSPM models builds under alinea standards"
@@ -62,7 +62,7 @@ def data_rel_pth(pth):
6262
license='cecill-c',
6363
zip_safe=False,
6464

65-
packages=find_packages('src'),
65+
packages=find_namespace_packages(where='src', include=['alinea', 'alinea.*', 'astk_data']),
6666
package_dir={'': 'src'},
6767

6868
include_package_data=True,
@@ -71,7 +71,6 @@ def data_rel_pth(pth):
7171
#tests_require=parse_requirements("dvlpt_requirements.txt"),
7272
entry_points={},
7373
keywords='',
74-
test_suite='nose.collector',
7574
)
7675
# #}
7776
# change setup_kwds below before the next pkglts tag

src/alinea/__init__.py

-4
This file was deleted.

src/alinea/astk/Weather.py

+3-14
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,17 @@
2020
def septo3d_reader(data_file, sep):
2121
""" reader for septo3D meteo files """
2222

23-
def parse(yr, doy, hr):
24-
""" Convert the 'An', 'Jour' and 'hhmm' variables of the
25-
meteo dataframe in a datetime object (%Y-%m-%d %H:%M:%S format)
26-
"""
27-
an, jour, heure = [int(x) for x in [yr, doy, int(hr) / 100]]
28-
dt = datetime(an - 1, 12, 31)
29-
delta = timedelta(days=jour, hours=heure)
30-
return dt + delta
31-
32-
data = pandas.read_csv(data_file,
33-
parse_dates={'date': ['An', 'Jour', 'hhmm']},
34-
date_parser=parse, sep=sep)
23+
data = pandas.read_csv(data_file, sep=sep)
3524
# ,
3625
# usecols=['An','Jour','hhmm','PAR','Tair','HR','Vent','Pluie'])
3726

27+
data['date'] = pandas.to_datetime(data['An'] * 1000 + data['Jour'], format='%Y%j')+pandas.to_timedelta(data.hhmm/100, unit='H')
3828
data.index = data.date
3929
data = data.rename(columns={'PAR': 'PPFD', 'Tair': 'temperature_air',
4030
'HR': 'relative_humidity', 'Vent': 'wind_speed',
4131
'Pluie': 'rain'})
4232
return data
4333

44-
4534
def PPFD_to_global(data):
4635
""" Convert the PAR (ppfd in micromol.m-2.sec-1)
4736
in global radiation (J.m-2.s-1, ie W/m2)
@@ -86,7 +75,7 @@ def linear_degree_days(data, start_date=None, base_temp=0., max_temp=35.):
8675
return dd - dd[df.index.searchsorted(start_date)]
8776

8877

89-
class Weather(object):
78+
class Weather:
9079
""" Class compliying echap local_microclimate model protocol (meteo_reader).
9180
expected variables of the data_file are:
9281
- 'An'

src/alinea/astk/version.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# -*- coding: utf-8 -*-
33

44
major = 2
5-
minor = 3
6-
post = 2
5+
minor = 4
6+
post = 0
77

88
__version__ = ".".join([str(s) for s in (major, minor, post)])
99
# #}

0 commit comments

Comments
 (0)