nfdata 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nfdata-0.1.0/PKG-INFO +104 -0
- nfdata-0.1.0/README.md +80 -0
- nfdata-0.1.0/config.create.example.yaml +228 -0
- nfdata-0.1.0/config.edit.example.yaml +14 -0
- nfdata-0.1.0/environment.yaml +13 -0
- nfdata-0.1.0/pyproject.toml +31 -0
- nfdata-0.1.0/setup.py +46 -0
- nfdata-0.1.0/src/nfdata/__init__.py +9 -0
- nfdata-0.1.0/src/nfdata/compiler.py +700 -0
- nfdata-0.1.0/src/nfdata/console.py +32 -0
- nfdata-0.1.0/src/nfdata/land_use.default.yaml +58 -0
- nfdata-0.1.0/src/nfdata/model_vars.yaml +224 -0
- nfdata-0.1.0/src/nfdata/router.py +111 -0
nfdata-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: nfdata
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Compile and edit input data for the NanoFASE model
|
|
5
|
+
License: BSD-3-Clause
|
|
6
|
+
Author: Sam Harrison
|
|
7
|
+
Author-email: samharrison.xg@gmail.com
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Requires-Dist: Pint (>=0.24.1,<0.25.0)
|
|
14
|
+
Requires-Dist: f90nml (>=1.4.4,<2.0.0)
|
|
15
|
+
Requires-Dist: geopandas (>=1.0.0,<2.0.0)
|
|
16
|
+
Requires-Dist: netCDF4 (>=1.7.1.post1,<2.0.0)
|
|
17
|
+
Requires-Dist: numpy (>=2.0.0,<3.0.0)
|
|
18
|
+
Requires-Dist: pandas (>=2.2.2,<3.0.0)
|
|
19
|
+
Requires-Dist: rasterio (>=1.3.10,<2.0.0)
|
|
20
|
+
Requires-Dist: ruamel.yaml (>=0.18.6,<0.19.0)
|
|
21
|
+
Requires-Dist: shapely (>=2.0.4,<3.0.0)
|
|
22
|
+
Project-URL: Documentation, https://nerc-ceh.github.io/nanofase
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# NanoFASE Data
|
|
26
|
+
|
|
27
|
+
The NanoFASE Data module is a set of scripts to compile and edit input data for the [NanoFASE model](https://github.com/nerc-ceh/nanofase).
|
|
28
|
+
|
|
29
|
+
[See the NanoFASE documentation for full documentation](https://nerc-ceh.github.io/nanofase/users/nanofase-data.html).
|
|
30
|
+
|
|
31
|
+
*Still in development. Use with caution!*
|
|
32
|
+
|
|
33
|
+
## Getting started
|
|
34
|
+
|
|
35
|
+
The easiest way to get started is to create a Conda environment using the provided [environment.yaml](./environment.yaml) file:
|
|
36
|
+
|
|
37
|
+
```shell script
|
|
38
|
+
$ conda env create -f environment.yaml
|
|
39
|
+
$ activate nanofase-data
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
If you don't want to use Conda, then this [environment.yaml](./environment.yaml) file lists the packages that need to be installed.
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
usage: nanofase_data.py [-h] [--output OUTPUT] {create,edit,constants} file
|
|
48
|
+
|
|
49
|
+
Compile or edit data for the NanoFASE model.
|
|
50
|
+
|
|
51
|
+
positional arguments:
|
|
52
|
+
{create,edit,constants}
|
|
53
|
+
do you wish to create from scratch, edit the data or
|
|
54
|
+
create a constants file?
|
|
55
|
+
file path to the config file (create/edit tasks) or
|
|
56
|
+
constants file (constants task)
|
|
57
|
+
|
|
58
|
+
optional arguments:
|
|
59
|
+
-h, --help show this help message and exit
|
|
60
|
+
--output OUTPUT, -o OUTPUT
|
|
61
|
+
where to create the new constants file (for constants
|
|
62
|
+
task)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Creating a new dataset
|
|
66
|
+
|
|
67
|
+
Specifying the "create" option compiles a new NetCDF dataset and Fortran namelist constant file:
|
|
68
|
+
|
|
69
|
+
```shell script
|
|
70
|
+
$ python nanofase_data.py create /path/to/config.create.yaml
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
An annotated example config file is given: [`config.create.example.yaml`](config.create.example.yaml). The file is quite self-explanatory, but a few further explanations are provided in [this document](docs/config.md).
|
|
74
|
+
|
|
75
|
+
The two files will be output to the paths specified in the config file.
|
|
76
|
+
|
|
77
|
+
### Editing an existing dataset
|
|
78
|
+
|
|
79
|
+
To edit an existing NetCDF dataset, specify the "edit" option:
|
|
80
|
+
|
|
81
|
+
```shell script
|
|
82
|
+
$ python nanofase_data.py edit /path/to/config.edit.yaml
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
An annotated example config file is given: [`config.edit.example.yaml`](config.edit.example.yaml). This is similar (but not identical) in format to the creation config file, except only those variables you with to edit should be specified (all other variables are left as-is).
|
|
86
|
+
|
|
87
|
+
Certain variables can't be edited: `flow_dir`, `is_estuary`. Create a new dataset instead if you wish to change these variables.
|
|
88
|
+
|
|
89
|
+
The Fortran namelist file cannot be edited using this method and you should instead edit the file directly.
|
|
90
|
+
|
|
91
|
+
### Only creating a new constants file
|
|
92
|
+
|
|
93
|
+
To simply convert a constants YAML file to a Fortran namelist file, you can use the `constants` option:
|
|
94
|
+
|
|
95
|
+
```shell script
|
|
96
|
+
$ python nanofase_data.py constants /path/to/constants.yaml -o /path/to/constants.nml
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
No config file is required. The location of the newly created constants file is given by the `-o` or `--output` argument.
|
|
100
|
+
|
|
101
|
+
### Tips
|
|
102
|
+
- For the moment, all rasters must be the same CRS as the `flow_dir` raster, and this must be a projected raster. We recommend ESPG:27700 (British National Grid). In addition, all rasters except for `land_use` must be the same resolution as `flow_dir`. They can cover a large geographical region and the module will automatically clip them to the correct size.
|
|
103
|
+
- Support for different file types is a bit sporadic at the moment. I suggest sticking the raster files for spatial variables, raster or CSV files for spatiotemporal variables (with 1 file per timestep for raster files) and shapefiles for point sources. You will trigger errors if you use an unsupported file.
|
|
104
|
+
- Example input data files are given in `data.example/thames_tio2_2015/`. Running the model using the example config files uses these data.
|
nfdata-0.1.0/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# NanoFASE Data
|
|
2
|
+
|
|
3
|
+
The NanoFASE Data module is a set of scripts to compile and edit input data for the [NanoFASE model](https://github.com/nerc-ceh/nanofase).
|
|
4
|
+
|
|
5
|
+
[See the NanoFASE documentation for full documentation](https://nerc-ceh.github.io/nanofase/users/nanofase-data.html).
|
|
6
|
+
|
|
7
|
+
*Still in development. Use with caution!*
|
|
8
|
+
|
|
9
|
+
## Getting started
|
|
10
|
+
|
|
11
|
+
The easiest way to get started is to create a Conda environment using the provided [environment.yaml](./environment.yaml) file:
|
|
12
|
+
|
|
13
|
+
```shell script
|
|
14
|
+
$ conda env create -f environment.yaml
|
|
15
|
+
$ activate nanofase-data
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If you don't want to use Conda, then this [environment.yaml](./environment.yaml) file lists the packages that need to be installed.
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
usage: nanofase_data.py [-h] [--output OUTPUT] {create,edit,constants} file
|
|
24
|
+
|
|
25
|
+
Compile or edit data for the NanoFASE model.
|
|
26
|
+
|
|
27
|
+
positional arguments:
|
|
28
|
+
{create,edit,constants}
|
|
29
|
+
do you wish to create from scratch, edit the data or
|
|
30
|
+
create a constants file?
|
|
31
|
+
file path to the config file (create/edit tasks) or
|
|
32
|
+
constants file (constants task)
|
|
33
|
+
|
|
34
|
+
optional arguments:
|
|
35
|
+
-h, --help show this help message and exit
|
|
36
|
+
--output OUTPUT, -o OUTPUT
|
|
37
|
+
where to create the new constants file (for constants
|
|
38
|
+
task)
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Creating a new dataset
|
|
42
|
+
|
|
43
|
+
Specifying the "create" option compiles a new NetCDF dataset and Fortran namelist constant file:
|
|
44
|
+
|
|
45
|
+
```shell script
|
|
46
|
+
$ python nanofase_data.py create /path/to/config.create.yaml
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
An annotated example config file is given: [`config.create.example.yaml`](config.create.example.yaml). The file is quite self-explanatory, but a few further explanations are provided in [this document](docs/config.md).
|
|
50
|
+
|
|
51
|
+
The two files will be output to the paths specified in the config file.
|
|
52
|
+
|
|
53
|
+
### Editing an existing dataset
|
|
54
|
+
|
|
55
|
+
To edit an existing NetCDF dataset, specify the "edit" option:
|
|
56
|
+
|
|
57
|
+
```shell script
|
|
58
|
+
$ python nanofase_data.py edit /path/to/config.edit.yaml
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
An annotated example config file is given: [`config.edit.example.yaml`](config.edit.example.yaml). This is similar (but not identical) in format to the creation config file, except only those variables you with to edit should be specified (all other variables are left as-is).
|
|
62
|
+
|
|
63
|
+
Certain variables can't be edited: `flow_dir`, `is_estuary`. Create a new dataset instead if you wish to change these variables.
|
|
64
|
+
|
|
65
|
+
The Fortran namelist file cannot be edited using this method and you should instead edit the file directly.
|
|
66
|
+
|
|
67
|
+
### Only creating a new constants file
|
|
68
|
+
|
|
69
|
+
To simply convert a constants YAML file to a Fortran namelist file, you can use the `constants` option:
|
|
70
|
+
|
|
71
|
+
```shell script
|
|
72
|
+
$ python nanofase_data.py constants /path/to/constants.yaml -o /path/to/constants.nml
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
No config file is required. The location of the newly created constants file is given by the `-o` or `--output` argument.
|
|
76
|
+
|
|
77
|
+
### Tips
|
|
78
|
+
- For the moment, all rasters must be the same CRS as the `flow_dir` raster, and this must be a projected raster. We recommend ESPG:27700 (British National Grid). In addition, all rasters except for `land_use` must be the same resolution as `flow_dir`. They can cover a large geographical region and the module will automatically clip them to the correct size.
|
|
79
|
+
- Support for different file types is a bit sporadic at the moment. I suggest sticking the raster files for spatial variables, raster or CSV files for spatiotemporal variables (with 1 file per timestep for raster files) and shapefiles for point sources. You will trigger errors if you use an unsupported file.
|
|
80
|
+
- Example input data files are given in `data.example/thames_tio2_2015/`. Running the model using the example config files uses these data.
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
nanomaterial: TiO2 # Name of the nanomaterial. Not used in model.
|
|
3
|
+
output:
|
|
4
|
+
nc_file: ./data.nc # Where do you want the output NetCDF file to be stored?
|
|
5
|
+
constants_file: ./constants.nml # Where do you want the output constants file to be stored?
|
|
6
|
+
constants_file: ./data.example/thames_tio2_2015/constants.yaml # Where is the input constants file?
|
|
7
|
+
land_use_config: ./data.example/thames_tio2_2015/land_use.yaml # Where is the input land use config file?
|
|
8
|
+
root_dir: ./data.example/thames_tio2_2015/ # Root dir, can be used in path variables below as <root_dir>
|
|
9
|
+
iso3: GBR # iso3 code for country modelled
|
|
10
|
+
time:
|
|
11
|
+
n: 365 # Number of timesteps to run the model for
|
|
12
|
+
dt: 86400 # Length of each timestep in seconds
|
|
13
|
+
start_date: 2015-01-01 # Start date for the model run
|
|
14
|
+
|
|
15
|
+
# Meteorological and hydrological
|
|
16
|
+
flow_dir: # Flow direction is responsible for defining the grid system
|
|
17
|
+
type: raster # Type can be raster or csv (see docs)
|
|
18
|
+
path: <root_dir>flow_dir.tif # Path to file, <root_dir> variable can be used from above
|
|
19
|
+
crs: EPSG:27700 # Manually specify CRS if it is absent or ill-defined in file
|
|
20
|
+
dem: # Digital Elevation Model, which defines the height above sea level
|
|
21
|
+
type: raster # of each grid cell, in metres
|
|
22
|
+
units: dm
|
|
23
|
+
path: <root_dir>dem.grd
|
|
24
|
+
runoff: # Runoff, usually provided by a hydrological model
|
|
25
|
+
type: csv
|
|
26
|
+
path: <root_dir>runoff.csv
|
|
27
|
+
units: mm/day # What units is the file in? These will be converted automatically by Pint: https://pint.readthedocs.io/en/0.10.1/
|
|
28
|
+
quickflow: # Quickflow (sometimes called direct runoff, or overland flow) is the portion of runoff that travels overland,
|
|
29
|
+
type: csv # and is usually provided by a hydrological model
|
|
30
|
+
path: <root_dir>quickflow.csv
|
|
31
|
+
units: mm/day
|
|
32
|
+
precip: # Precipitation
|
|
33
|
+
type: raster
|
|
34
|
+
path: <root_dir>precip/rainfall_5km_2015-{t}.tif # If the variable is spatiotemporal, multiple raster files can be indexed by {t}, with one file per timestep
|
|
35
|
+
units: mm/day
|
|
36
|
+
t_min: 1 # What index should the multiple input files start at (default is 0)?
|
|
37
|
+
# Source and references can be provided and whilst these aren't used by the model, they will be added as attributes to the NetCDF file
|
|
38
|
+
source: Provided information about the source of the data here, and any data processing it has already been through (e.g. reprojection).
|
|
39
|
+
references: References to scientific papers.
|
|
40
|
+
|
|
41
|
+
# Soil
|
|
42
|
+
# Most soil properties can be obtained from the European Soil Data Center (ESDAC): https://esdac.jrc.ec.europa.eu/
|
|
43
|
+
soil_bulk_density:
|
|
44
|
+
type: raster
|
|
45
|
+
units: t/m**3
|
|
46
|
+
path: <root_dir>soil_bulk_density.tif
|
|
47
|
+
# Source example:
|
|
48
|
+
source: European Soil Data Centre topsoil physical properties resampled to OS National Grid (ESPG:27700) by bilinear interpolation. See https://esdac.jrc.ec.europa.eu/content/topsoil-physical-properties-europe-based-lucas-topsoil-data.
|
|
49
|
+
soil_water_content_field_capacity:
|
|
50
|
+
type: raster
|
|
51
|
+
path: <root_dir>soil_water_content_field_capacity.tif
|
|
52
|
+
soil_water_content_saturation:
|
|
53
|
+
type: raster
|
|
54
|
+
path: <root_dir>soil_water_content_saturation.tif
|
|
55
|
+
soil_hydraulic_conductivity:
|
|
56
|
+
type: raster
|
|
57
|
+
units: cm/day
|
|
58
|
+
path: <root_dir>soil_hydraulic_conductivity.tif
|
|
59
|
+
soil_texture_sand_content: # Sand content as a percentage. Sand + clay + silt must equal 100%
|
|
60
|
+
type: raster
|
|
61
|
+
path: <root_dir>soil_texture_sand_content.tif
|
|
62
|
+
soil_texture_clay_content:
|
|
63
|
+
type: raster
|
|
64
|
+
path: <root_dir>soil_texture_clay_content.tif
|
|
65
|
+
soil_texture_silt_content:
|
|
66
|
+
type: raster
|
|
67
|
+
path: <root_dir>soil_texture_silt_content.tif
|
|
68
|
+
soil_texture_coarse_frag_content:
|
|
69
|
+
type: raster
|
|
70
|
+
path: <root_dir>soil_texture_coarse_frag_content.tif
|
|
71
|
+
soil_usle_c_factor: # Universal Soil Loss Equation (USLE) cover management factor
|
|
72
|
+
type: raster
|
|
73
|
+
path: <root_dir>soil_usle_c_factor.tif
|
|
74
|
+
soil_usle_ls_factor: # USLE topography (slope length and steepness) factor
|
|
75
|
+
type: raster
|
|
76
|
+
path: <root_dir>soil_usle_ls_factor.tif
|
|
77
|
+
soil_usle_p_factor: # USLE support practices factor
|
|
78
|
+
type: raster
|
|
79
|
+
path: <root_dir>soil_usle_p_factor.tif
|
|
80
|
+
|
|
81
|
+
# Suspended sediment
|
|
82
|
+
bank_erosion_alpha:
|
|
83
|
+
type: raster
|
|
84
|
+
path: <root_dir>bank_erosion_alpha.tif
|
|
85
|
+
units: kg/m**5
|
|
86
|
+
bank_erosion_beta:
|
|
87
|
+
type: raster
|
|
88
|
+
path: <root_dir>bank_erosion_beta.tif
|
|
89
|
+
deposition_alpha:
|
|
90
|
+
type: raster
|
|
91
|
+
path: <root_dir>deposition_alpha.tif
|
|
92
|
+
deposition_beta:
|
|
93
|
+
type: raster
|
|
94
|
+
path: <root_dir>deposition_beta.tif
|
|
95
|
+
resuspension_alpha:
|
|
96
|
+
type: raster
|
|
97
|
+
path: <root_dir>resuspension_alpha.tif
|
|
98
|
+
resuspension_beta:
|
|
99
|
+
type: raster
|
|
100
|
+
path: <root_dir>resuspension_beta.tif
|
|
101
|
+
sediment_transport_a:
|
|
102
|
+
type: raster
|
|
103
|
+
path: <root_dir>sediment_transport_a.tif
|
|
104
|
+
sediment_transport_c:
|
|
105
|
+
type: raster
|
|
106
|
+
path: <root_dir>sediment_transport_c.tif
|
|
107
|
+
|
|
108
|
+
# Land use
|
|
109
|
+
land_use:
|
|
110
|
+
type: raster
|
|
111
|
+
path: <root_dir>land_use.tif
|
|
112
|
+
is_estuary: # Boolean raster indicating whether waterbodies within a cell are estuarine
|
|
113
|
+
type: raster
|
|
114
|
+
path: <root_dir>is_estuary.tif
|
|
115
|
+
|
|
116
|
+
# Emissions - areal
|
|
117
|
+
# Variables can be omitted and emissions for that variable will be set to zero (e.g. if a particular form is not relevant for the NM modelled)
|
|
118
|
+
emissions_areal_soil_pristine: # Areal emissions of pristine NM to soil
|
|
119
|
+
type: raster
|
|
120
|
+
path: <root_dir>emissions_areal_soil_pristine.tif
|
|
121
|
+
units: kg/m**2/year
|
|
122
|
+
emissions_areal_soil_matrixembedded: # Areal emissions of matrix-embedded NM to soil
|
|
123
|
+
type: raster
|
|
124
|
+
path: <root_dir>emissions_areal_soil_matrixembedded.tif
|
|
125
|
+
units: kg/m**2/year
|
|
126
|
+
emissions_areal_soil_transformed: # Areal emissions of transformed NM to soil
|
|
127
|
+
type: raster
|
|
128
|
+
path: <root_dir>emissions_areal_soil_transformed.tif
|
|
129
|
+
units: kg/m**2/year
|
|
130
|
+
#emissions_areal_soil_dissolved: # Areal emissions of dissolved NM to soil
|
|
131
|
+
# type: raster
|
|
132
|
+
# path: <root_dir>emissions_areal_soil_dissolved.tif
|
|
133
|
+
# units: kg/m**2/year
|
|
134
|
+
emissions_areal_water_pristine: # Areal emissions of pristine NM to water
|
|
135
|
+
type: raster
|
|
136
|
+
path: <root_dir>emissions_areal_water_pristine.tif
|
|
137
|
+
units: kg/m**2/year
|
|
138
|
+
emissions_areal_water_matrixembedded: # Areal emissions of matrix-embedded NM to water
|
|
139
|
+
type: raster
|
|
140
|
+
path: <root_dir>emissions_areal_water_matrixembedded.tif
|
|
141
|
+
units: kg/m**2/year
|
|
142
|
+
emissions_areal_water_transformed: # Areal emissions of transformed NM to water
|
|
143
|
+
type: raster
|
|
144
|
+
path: <root_dir>emissions_areal_water_transformed.tif
|
|
145
|
+
units: kg/m**2/year
|
|
146
|
+
#emissions_areal_water_dissolved: # Areal emissions of dissolved NM to water
|
|
147
|
+
# type: raster
|
|
148
|
+
# path: <root_dir>emissions_areal_water_dissolved.tif
|
|
149
|
+
# units: kg/m**2/year
|
|
150
|
+
|
|
151
|
+
# Emissions - point
|
|
152
|
+
emissions_point_water_pristine: # Point source emissions of pristine NM to water
|
|
153
|
+
type: shapefile # Point source emissions must be a shapefile
|
|
154
|
+
value_var: emission # Which variable in the shapefile gives the emission value?
|
|
155
|
+
path: <root_dir>emissions_point_water_pristine/point_sources_water_pristine_2015_osgb.shp # Path to .shp file. Sidecar files must be present too
|
|
156
|
+
source_type_col: profile # Which variable in the shapefile gives the profile of each point? See the docs
|
|
157
|
+
temporal_profile: # Temporal profile for these emissions
|
|
158
|
+
path: <root_dir>emissions_temporal-profile_2015.csv # Path to temporal profile CSV (see docs)
|
|
159
|
+
source_type_col: Emission_source_type # Which column gives the emission source type profile?
|
|
160
|
+
for_source_type: P2 # Which of these types does this temporal profile apply to?
|
|
161
|
+
factor_col: Factor # Which column gives the factor?
|
|
162
|
+
units: kg/year
|
|
163
|
+
emissions_point_water_matrixembedded: # Point source emissions of matrix-embedded NM to water
|
|
164
|
+
type: shapefile
|
|
165
|
+
value_var: emission
|
|
166
|
+
path: <root_dir>emissions_point_water_matrixembedded/point_sources_water_matrix-embedded_2015_osgb.shp
|
|
167
|
+
source_type_col: profile
|
|
168
|
+
temporal_profile:
|
|
169
|
+
path: <root_dir>emissions_temporal-profile_2015.csv
|
|
170
|
+
source_type_col: Emission_source_type
|
|
171
|
+
for_source_type: P2
|
|
172
|
+
factor_col: Factor
|
|
173
|
+
units: kg/year
|
|
174
|
+
emissions_point_water_transformed: # Point source emissions of transformed NM to water
|
|
175
|
+
type: shapefile
|
|
176
|
+
value_var: emission
|
|
177
|
+
path: <root_dir>emissions_point_water_transformed/point_sources_water_transformed_2015_osgb.shp
|
|
178
|
+
source_type_col: profile
|
|
179
|
+
temporal_profile:
|
|
180
|
+
path: <root_dir>emissions_temporal-profile_2015.csv
|
|
181
|
+
source_type_col: Emission_source_type
|
|
182
|
+
for_source_type: P2
|
|
183
|
+
factor_col: Factor
|
|
184
|
+
units: kg/year
|
|
185
|
+
#emissions_point_water_dissolved: # Point source emissions of dissolved NM to water
|
|
186
|
+
# type: shapefile
|
|
187
|
+
# value_var: emission
|
|
188
|
+
# path: <root_dir>point_sources_water_dissolved.shp
|
|
189
|
+
# source_type_col: profile
|
|
190
|
+
# temporal_profile:
|
|
191
|
+
# path: <root_dir>emissions_temporal-profile_2015.csv
|
|
192
|
+
# source_type_col: Emission_source_type
|
|
193
|
+
# for_source_type: P2
|
|
194
|
+
# factor_col: Factor
|
|
195
|
+
# units: kg/year
|
|
196
|
+
|
|
197
|
+
# Emissions - atmospheric
|
|
198
|
+
# Atmospheric deposition data can be provided as dry deposition (drydep) and wet deposition (wetdepo)
|
|
199
|
+
emissions_atmospheric_drydepo_pristine:
|
|
200
|
+
type: raster
|
|
201
|
+
path: <root_dir>emissions_atmospheric_drydepo_pristine/{t}.tif # {t} placeholder is used to iterate over files, with 1 file for each timestep
|
|
202
|
+
units: kg/m**2/s
|
|
203
|
+
t_min: 1
|
|
204
|
+
emissions_atmospheric_drydepo_matrixembedded:
|
|
205
|
+
type: raster
|
|
206
|
+
path: <root_dir>emissions_atmospheric_drydepo_matrix-embedded/{t}.tif
|
|
207
|
+
units: kg/m**2/s
|
|
208
|
+
t_min: 1
|
|
209
|
+
emissions_atmospheric_drydepo_transformed:
|
|
210
|
+
type: raster
|
|
211
|
+
path: <root_dir>emissions_atmospheric_drydepo_transformed/{t}.tif
|
|
212
|
+
units: kg/m**2/s
|
|
213
|
+
t_min: 1
|
|
214
|
+
emissions_atmospheric_wetdepo_pristine:
|
|
215
|
+
type: raster
|
|
216
|
+
path: <root_dir>emissions_atmospheric_wetdepo_pristine/{t}.tif
|
|
217
|
+
units: kg/m**2/s
|
|
218
|
+
t_min: 1
|
|
219
|
+
emissions_atmospheric_wetdepo_matrixembedded:
|
|
220
|
+
type: raster
|
|
221
|
+
path: <root_dir>emissions_atmospheric_wetdepo_matrix-embedded/{t}.tif
|
|
222
|
+
units: kg/m**2/s
|
|
223
|
+
t_min: 1
|
|
224
|
+
emissions_atmospheric_wetdepo_transformed:
|
|
225
|
+
type: raster
|
|
226
|
+
path: <root_dir>emissions_atmospheric_wetdepo_transformed/{t}.tif
|
|
227
|
+
units: kg/m**2/s
|
|
228
|
+
t_min: 1
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
input_nc_file: ./data.nc # Where is the input NetCDF file to edit?
|
|
2
|
+
output_nc_file: ./data_edited.nc # Where do you want to put the output NetCDF file? Defaults to same as input_nc_file
|
|
3
|
+
root_dir: ./data.example # Root dir, can be used in path variables below as <root_dir>
|
|
4
|
+
iso3: GBR # Required if editing point sources
|
|
5
|
+
|
|
6
|
+
# Include variables to edit in the same format as config.create.example.yaml.
|
|
7
|
+
soil_bulk_density:
|
|
8
|
+
type: raster
|
|
9
|
+
path: <root_dir>thames_random_raster.tif
|
|
10
|
+
units: t/m**3
|
|
11
|
+
emissions_areal_soil_pristine:
|
|
12
|
+
type: raster
|
|
13
|
+
path: <root_dir>thames_constant_raster.tif
|
|
14
|
+
units: kg/m**2/year
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "nfdata"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Compile and edit input data for the NanoFASE model"
|
|
5
|
+
authors = ["Sam Harrison <samharrison.xg@gmail.com>"]
|
|
6
|
+
license = "BSD-3-Clause"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
documentation = "https://nerc-ceh.github.io/nanofase"
|
|
9
|
+
include = [
|
|
10
|
+
{ path = "*.yaml", format = ["sdist", "wheel"] }
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
[tool.poetry.scripts]
|
|
14
|
+
nfdata = 'nfdata.console:run'
|
|
15
|
+
|
|
16
|
+
[tool.poetry.dependencies]
|
|
17
|
+
python = "^3.10"
|
|
18
|
+
numpy = "^2.0.0"
|
|
19
|
+
pandas = "^2.2.2"
|
|
20
|
+
geopandas = "^1.0.0"
|
|
21
|
+
rasterio = "^1.3.10"
|
|
22
|
+
"ruamel.yaml" = "^0.18.6"
|
|
23
|
+
netCDF4 = "^1.7.1.post1"
|
|
24
|
+
shapely = "^2.0.4"
|
|
25
|
+
Pint = "^0.24.1"
|
|
26
|
+
f90nml = "^1.4.4"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
[build-system]
|
|
30
|
+
requires = ["poetry-core"]
|
|
31
|
+
build-backend = "poetry.core.masonry.api"
|
nfdata-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from setuptools import setup
|
|
3
|
+
|
|
4
|
+
package_dir = \
|
|
5
|
+
{'': 'src'}
|
|
6
|
+
|
|
7
|
+
packages = \
|
|
8
|
+
['nfdata']
|
|
9
|
+
|
|
10
|
+
package_data = \
|
|
11
|
+
{'': ['*']}
|
|
12
|
+
|
|
13
|
+
install_requires = \
|
|
14
|
+
['Pint>=0.24.1,<0.25.0',
|
|
15
|
+
'f90nml>=1.4.4,<2.0.0',
|
|
16
|
+
'geopandas>=1.0.0,<2.0.0',
|
|
17
|
+
'netCDF4>=1.7.1.post1,<2.0.0',
|
|
18
|
+
'numpy>=2.0.0,<3.0.0',
|
|
19
|
+
'pandas>=2.2.2,<3.0.0',
|
|
20
|
+
'rasterio>=1.3.10,<2.0.0',
|
|
21
|
+
'ruamel.yaml>=0.18.6,<0.19.0',
|
|
22
|
+
'shapely>=2.0.4,<3.0.0']
|
|
23
|
+
|
|
24
|
+
entry_points = \
|
|
25
|
+
{'console_scripts': ['nfdata = nfdata.console:run']}
|
|
26
|
+
|
|
27
|
+
setup_kwargs = {
|
|
28
|
+
'name': 'nfdata',
|
|
29
|
+
'version': '0.1.0',
|
|
30
|
+
'description': 'Compile and edit input data for the NanoFASE model',
|
|
31
|
+
'long_description': '# NanoFASE Data\n\nThe NanoFASE Data module is a set of scripts to compile and edit input data for the [NanoFASE model](https://github.com/nerc-ceh/nanofase).\n\n[See the NanoFASE documentation for full documentation](https://nerc-ceh.github.io/nanofase/users/nanofase-data.html).\n\n*Still in development. Use with caution!*\n\n## Getting started\n\nThe easiest way to get started is to create a Conda environment using the provided [environment.yaml](./environment.yaml) file:\n\n```shell script\n$ conda env create -f environment.yaml\n$ activate nanofase-data\n```\n\nIf you don\'t want to use Conda, then this [environment.yaml](./environment.yaml) file lists the packages that need to be installed.\n\n## Usage\n\n```\nusage: nanofase_data.py [-h] [--output OUTPUT] {create,edit,constants} file\n\nCompile or edit data for the NanoFASE model.\n\npositional arguments:\n {create,edit,constants}\n do you wish to create from scratch, edit the data or\n create a constants file?\n file path to the config file (create/edit tasks) or\n constants file (constants task)\n\noptional arguments:\n -h, --help show this help message and exit\n --output OUTPUT, -o OUTPUT\n where to create the new constants file (for constants\n task)\n```\n\n### Creating a new dataset\n\nSpecifying the "create" option compiles a new NetCDF dataset and Fortran namelist constant file:\n\n```shell script\n$ python nanofase_data.py create /path/to/config.create.yaml\n```\n\nAn annotated example config file is given: [`config.create.example.yaml`](config.create.example.yaml). The file is quite self-explanatory, but a few further explanations are provided in [this document](docs/config.md).\n\nThe two files will be output to the paths specified in the config file.\n\n### Editing an existing dataset\n\nTo edit an existing NetCDF dataset, specify the "edit" option:\n\n```shell script\n$ python nanofase_data.py edit /path/to/config.edit.yaml\n```\n\nAn annotated example config file is given: [`config.edit.example.yaml`](config.edit.example.yaml). This is similar (but not identical) in format to the creation config file, except only those variables you with to edit should be specified (all other variables are left as-is).\n\nCertain variables can\'t be edited: `flow_dir`, `is_estuary`. Create a new dataset instead if you wish to change these variables.\n\nThe Fortran namelist file cannot be edited using this method and you should instead edit the file directly.\n\n### Only creating a new constants file\n\nTo simply convert a constants YAML file to a Fortran namelist file, you can use the `constants` option:\n\n```shell script\n$ python nanofase_data.py constants /path/to/constants.yaml -o /path/to/constants.nml\n```\n\nNo config file is required. The location of the newly created constants file is given by the `-o` or `--output` argument.\n\n### Tips\n- For the moment, all rasters must be the same CRS as the `flow_dir` raster, and this must be a projected raster. We recommend ESPG:27700 (British National Grid). In addition, all rasters except for `land_use` must be the same resolution as `flow_dir`. They can cover a large geographical region and the module will automatically clip them to the correct size.\n- Support for different file types is a bit sporadic at the moment. I suggest sticking the raster files for spatial variables, raster or CSV files for spatiotemporal variables (with 1 file per timestep for raster files) and shapefiles for point sources. You will trigger errors if you use an unsupported file.\n- Example input data files are given in `data.example/thames_tio2_2015/`. Running the model using the example config files uses these data. ',
|
|
32
|
+
'author': 'Sam Harrison',
|
|
33
|
+
'author_email': 'samharrison.xg@gmail.com',
|
|
34
|
+
'maintainer': 'None',
|
|
35
|
+
'maintainer_email': 'None',
|
|
36
|
+
'url': 'None',
|
|
37
|
+
'package_dir': package_dir,
|
|
38
|
+
'packages': packages,
|
|
39
|
+
'package_data': package_data,
|
|
40
|
+
'install_requires': install_requires,
|
|
41
|
+
'entry_points': entry_points,
|
|
42
|
+
'python_requires': '>=3.10,<4.0',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
setup(**setup_kwargs)
|