Package to handle input DSSAT files
Project description
README
This is a package to handle DSSAT input and output files
Way2DSSAT.SOL() : Creates DSSAT Soil File (SG.SOL)
Use Way2DSSAT.SOL("path/to/you/gssurgo.csv") to create a soil file first. The funciton will save a SG.SOL file. It also returns a dictionary of soil depth:SDUL which will be used as intial conditions in the Xfile. a string of MUKEYS of all the soil profiles created.
If you have multiple soil profiles in the csv exported from GSSURGO data, different soil profiles will be created with name convention of soil ID as "SGG"+"MUKEY".eg. GSS2733103.
Since the funciton is designed to handle the csv generated from gSSURGO soil database. It is aware of the column names which the gSSURGO arcmap toolbox generates. Thus no need to remove any columns containing .pct string in the column name.
Columns required:
* path to your .csv file containing the data from gSSURGO. Must have the following columns(and other related depths)
* WC15Bar_DCP_0to5
* WC3rdbar_DCP_0to5
* Clay_DCP_0to5
* Silt_DCP_0to5
* pHwater_DCP_0to5
* CEC_DCP_0to5
* Db3rdbar_DCP_0to5
* Ksat_DCP_0to5
* OrgMatter_DCP_0to5
* MUKEY_DCP_0to5
ImportantSave the returned dicitonary to a variable For eg. returned dictionary is:
{'GSS2733103': {5: 0.2, 15: 0.2, 30: 0.2, 60: 0.2, 100: 0.338, 200: 0.308}, 'GSS2733104': {5: 0.2, 15: 0.2, 30: 0.2, 60: 0.2, 100: 0.338, 200: 0.308}}
- 'GSS2733103' is soil ID (individual soil profile)
- {5: 0.2, 15: 0.2, 30: 0.2, 60: 0.2, 100: 0.338, 200: 0.308} is a dictinary of key=depth, value=SDUL.
Incase of multiple profiles (as here), there is a need to further save the Individual sub-dictionaries(nested dictionary) to different variables. Individual sub-dictionary has to be provided as the Input argument Inside the Way2DSSAT.Xfile() funciton.
Example
path = 'Username/pathtothecsv'.
A,B = Way2DSSAT.SOL(path)
A is the returned dictionary B is the list of (MUKEYS) Soil profiles
Way2DSSAT.WTH() : Creates .WTH file
This function creates a weather file of DSSAT format .WTH by taking input as paath to the .csv file contaitng weather data. The funciton is writes single year data thus csv should contain data from once year. Although it will create .WTH file even if the data is not from a single year but the name of the outputfile will be saved using the year of first row of the .csv.
The funciton also returns the name of the file created.
Following columns are required - 'SRAD','Tmax','Tmin','Rain','timedate' - 'timedate' in format = '%m/%d/%Y'
Example
path = "path/to/your/weatherdata.csv"
Way2DSSAT.WTH(path,
stname = 'ABCd',
latitude= 34.583,
longitude= -103.200,
elevation= 1348)
Way2DSSAT.Xfile() : Creates .SNX file
It creates DSSAT seasonal file (.SNX) from a reference template. Click here to download
The dictionary created above using .SOL funciton is used as an argument along with other arguments as shown here
A,B = Way2DSSAT("path/to/csvfromssurgo.csv")
print(A)
#this will return
{'GSS2733103': {5: 0.2, 15: 0.2, 30: 0.2, 60: 0.2, 100: 0.338, 200: 0.308}, 'GSS2733104': {5: 0.2, 15: 0.2, 30: 0.2, 60: 0.2, 100: 0.338, 200: 0.308}}
We need {5: 0.2, 15: 0.2, 30: 0.2, 60: 0.2, 100: 0.338, 200: 0.308}
path = 'path/to/template.SNX'
init_cond = A['GSS2733103'] #Relace with the soil id you get from print(A)
Xfile(path,init_cond,site_name = '-99',station = 'ABCD',soil = 'GSS2733103',
crop = 'SB',cultivar = 'NE0006 NECPHA4 2014',planting_date = '24145')
#replace the default information
All the output files are stored in CWD
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file way2dssat-0.0.9.tar.gz.
File metadata
- Download URL: way2dssat-0.0.9.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13e7075ac9b327dbf78ce97a42d72335f028bb355404c5d617bb19d042359be8
|
|
| MD5 |
513458eedfb5e989ec98ba4aec556f07
|
|
| BLAKE2b-256 |
e55b9178bb7bf8264a255e0e64f008ee60b2e5307cd6da212f8919500ffa2108
|
File details
Details for the file Way2DSSAT-0.0.9-py3-none-any.whl.
File metadata
- Download URL: Way2DSSAT-0.0.9-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb625a447045d0ac45777ff224fbe39e274cc9c402eefeec0ab3e8163fa3eb40
|
|
| MD5 |
bbac353481642eee6417bddcc1d390e6
|
|
| BLAKE2b-256 |
7e7554e30f316b4a46864c098c9b08b570d447e605c526f174f362697705cd73
|