Code Monkey home page Code Monkey logo

supy's Introduction

SuPy

THIS PROJECT IS ARCHIVED AND NOW MAINTAINED HERE BY @UMEP-dev.

Python Version Support Status Latest Version Status Downloads Launch Binder

Build Status Documentation Status DOI

SUEWS that speaks Python

Installation

SuPy requires 64-bit python 3.6+ and can be installed with pip in command line prompt:

python3 -m pip install supy --upgrade

Quick Demo

Once installed, supy can be quickly started to get SUEWS simulations done:

import supy as sp
import matplotlib.pyplot as plt

#load sample data
df_state_init, df_forcing = sp.load_SampleData()
grid = df_state_init.index[0]

#run supy/SUEWS simulation
df_output, df_state_end = sp.run_supy(df_forcing, df_state_init)

#plot results and save figure
res_plot = df_output.SUEWS.loc[grid, ['QN', 'QF', 'QS', 'QE', 'QH']]
ax=res_plot.loc['2012 6 4':'2012 6 6'].resample('30T').mean().plot()
plt.show()
ax.figure.savefig('sample_plot.png')

The above code will produce a plot of surface energy balance components as follows:

sample plot

Tutorial

Please check out more SuPy tutorials here!

supy's People

Contributors

azure-pipelines[bot] avatar dependabot-preview[bot] avatar hamidrezaomidvar avatar izzywillow avatar matlipson avatar sunt05 avatar xiaoxiongxie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

supy's Issues

quickstart tutorial - grid level

Describe the Issue
A clear and concise description of what the issue is.

Location
Following the convention of SUEWS, supy loads meteorological forcing (met-forcing) files at the grid level.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
grid level -- what is meant by this? for individual grids?

Create a diagnostic function to save user's model states

Describe the Issue
Add to the manual -- then send a link -- when someone encounters a problem -- then instructions etc will become clearer and can be used by others

Location
Problem from a User -

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Please do the following:

  1. dump df_state_init and df_forcing as pickle files:
df_state_init.to_pickle("df_state_init.pkl")
df_forcing.to_pickle("df_forcing.pkl")
  1. save the .pkl files and your notebook into one archive file (e.g., test.zip)

64 bit Python3

Describe the Issue
Need to indicate which version of Python needs to be installed

Location
quick start

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Useful links for Python-based data analysis/modelling

Describe the Issue
Need a starting point if someone doesn't know anything about Python. At the moment this is harder to get started than for someone who is not familiar with Fortran.

Location
The link to the page you noticed an issue.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Kc_SUEWS_OutputFormat.txt not created in SuPy

Filecode_SUEWS_OutputFormat.txt is not created in SuPy. This file should be created using supy.save_supy or is this information available somewhere else now? This file is used to create scroll-down lists in UMEP.

Forcing data need to be checked

Describe the Issue
Checking the forcing data?

  1. Are there are no gaps
  2. Are all the data there (e.g. rainfall)

Location
The link to the page you noticed an issue.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Shui Liu analysis - for site -- but no rainfall data

Make SuPy work with QgsTask in QGIS3

QGIS3 provides capabilities to use tasks, i.e. threads which will make QGIS3 functional when SuPY is running. This probably requires that SuPY tells QGIS when computation is finished.

UMEP/QGIS3 crash when SuPy produce error

QGIS3 crash when error is happening in SuPy. I set netradiationmethod=43 in RunControl.nml and QGIS3 crash before eroor message appear in python console.

SuPY version 2019.4.17
QGIS version 3.6.1

Requirement modules

Describe the Issue
lmfit needs to be added as requirement modules

Location
The link to the page you noticed an issue.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

No plotting in Windows

No plots are produced on my Windows. The following code is used:

import supy as sp
import pandas as pd
import numpy as np
from pathlib import Path
#matplotlib inline
import time

path_runcontrol = Path('C:/Users/xlinfr/Documents/PythonScripts/Testthings/UMEP_run/RunControl.nml')
df_state_init = sp.init_supy(path_runcontrol)
grid = df_state_init.index[0]
df_forcing = sp.load_forcing_grid(path_runcontrol, grid)
t1_start = time.process_time()
df_output, df_state_final = sp.run_supy(df_forcing, df_state_init)
t1_stop = time.process_time()
print(t1_stop - t1_start)
df_output_suews=df_output['SUEWS']
df_output_suews_rsmp=df_output_suews.loc[grid].resample('1h').mean()
df_output_suews_rsmp.loc[:,['QN','QS','QE','QH','QF']].plot()

Loading df_state_init from files

Describe the Issue
A clear and concise description of what the issue is.
Not sure it is SuPy related or Jupiter notebook related. When I load the df_state_init data using SuPy, and then if I change a parameters in the run folder, e.g. Frpaved, and again load df_state_init, the new values are not loaded. I need to restart the kernel and run the scripts again to fix this problem. I was wondering if this is intentional to make sure users try to change the parameters indirectly from SuPy not the files.
Location
The link to the page you noticed an issue.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Input files changes in new version

Where can I find changes in input files made since 2018a? I got errors now when running data from older versions.

An error has occurred while executing Python code:

KeyError: "None of [[('TrafficRate_WD', 'base', 'base'), ('TrafficRate_WE', 'base', 'base')]] are in the [columns]"
Traceback (most recent call last):
File "C:/Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\SuewsSimple\suews_simple.py", line 545, in start_progress
Suews_wrapper_v2019a.wrapper(self.model_dir)
File "C:/Users/xlinfr/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\UMEP\suewsmodel\Suews_wrapper_v2019a.py", line 35, in wrapper
df_state_init = sp.init_supy(path_runcontrol)
File "C:\OSGEO41\apps\Python37\lib\site-packages\supy\supy_module.py", line 69, in init_supy
df_state_init = load_InitialCond_grid_df(path_runcontrol_x)
File "C:\OSGEO4
1\apps\Python37\lib\site-packages\supy\supy_load.py", line 1482, in load_InitialCond_grid_df
df_init = load_SUEWS_InitialCond_df(path_runcontrol)
File "C:\OSGEO41\apps\Python37\lib\site-packages\supy\supy_load.py", line 1270, in load_SUEWS_InitialCond_df
df_gridSurfaceChar = load_SUEWS_SurfaceChar_df(path_input)
File "C:\OSGEO4
1\apps\Python37\lib\site-packages\supy\supy_load.py", line 1024, in load_SUEWS_SurfaceChar_df
df_gridSurfaceChar_exp = gen_df_gridSurfaceChar_exp(path_input)
File "C:\OSGEO41\apps\Python37\lib\site-packages\supy\supy_load.py", line 1014, in gen_df_gridSurfaceChar_exp
for k in dict_var_tuple
File "C:\OSGEO4
1\apps\Python37\lib\site-packages\supy\supy_load.py", line 1014, in
for k in dict_var_tuple
File "C:\OSGEO41\apps\Python37\lib\site-packages\pandas\core\indexing.py", line 1472, in getitem
return self._getitem_tuple(key)
File "C:\OSGEO4
1\apps\Python37\lib\site-packages\pandas\core\indexing.py", line 870, in _getitem_tuple
return self._getitem_lowerdim(tup)
File "C:\OSGEO41\apps\Python37\lib\site-packages\pandas\core\indexing.py", line 979, in _getitem_lowerdim
return self._getitem_nested_tuple(tup)
File "C:\OSGEO4
1\apps\Python37\lib\site-packages\pandas\core\indexing.py", line 1058, in _getitem_nested_tuple
obj = getattr(obj, self.name)._getitem_axis(key, axis=axis)
File "C:\OSGEO41\apps\Python37\lib\site-packages\pandas\core\indexing.py", line 1901, in _getitem_axis
return self._getitem_iterable(key, axis=axis)
File "C:\OSGEO4
1\apps\Python37\lib\site-packages\pandas\core\indexing.py", line 1143, in _getitem_iterable
self._validate_read_indexer(key, indexer, axis)
File "C:\OSGEO4~1\apps\Python37\lib\site-packages\pandas\core\indexing.py", line 1206, in _validate_read_indexer
key=key, axis=self.obj._get_axis_name(axis)))
KeyError: "None of [[('TrafficRate_WD', 'base', 'base'), ('TrafficRate_WE', 'base', 'base')]] are in the [columns]"

Tutorials - example of changing data

Describe the Issue
Need to show users how to modify model parameters etc. e.g Tutorial 1 - change land surface fractions

Location
The link to the page you noticed an issue.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.