Skip to main content

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

way2dssat-0.0.11.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Way2DSSAT-0.0.11-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file way2dssat-0.0.11.tar.gz.

File metadata

  • Download URL: way2dssat-0.0.11.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

Hashes for way2dssat-0.0.11.tar.gz
Algorithm Hash digest
SHA256 e5a8361c957eea4dccd992389faef82a661c7737898588615c3bbd097bec9312
MD5 54cce944334ed285bc0767fb61c71b00
BLAKE2b-256 75b9a1734402afdbb569992f23ef72f6296bf485743c3df826f90693cf0a1870

See more details on using hashes here.

File details

Details for the file Way2DSSAT-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: Way2DSSAT-0.0.11-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

Hashes for Way2DSSAT-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 8d0d3cd6240f7165a98fb3be62e76b2cdd975f3a346427188b236d1df8593c31
MD5 b43b2d60f9da17d27f4c2093b493aec6
BLAKE2b-256 b004743149a066c0a74626c8214fa571a5cd7e022865bce02148b81ccab065a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page