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.10.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.10-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: way2dssat-0.0.10.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.10.tar.gz
Algorithm Hash digest
SHA256 27f17014c545cb0feae500bbfda9d82dc23d689f343a2930d80b8edd939d2ec3
MD5 d72c104a8021ca0c03ba46801e781ed0
BLAKE2b-256 e235dc867278b9f74c5de58c8d411898e7cb9e57ded8d14e011b80cea0970ca0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Way2DSSAT-0.0.10-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.10-py3-none-any.whl
Algorithm Hash digest
SHA256 4d10c2c8a37f4b4fa8577c194648038fff40198eaa84fc876880a33c8a7f8a7d
MD5 bba29735fdbd31690363adfb623f9aea
BLAKE2b-256 72f6feb1ac9728db34999085037709c1b4cd054965cf42d46d4ec48be52cbec8

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