From b7bfa22c75db2bb58298ca13ff588a0a7edc7ac7 Mon Sep 17 00:00:00 2001 From: Chris Waigl Date: Thu, 1 Dec 2022 13:34:19 -0900 Subject: [PATCH 1/6] added basic infrastructure to make an installable package --- setup.py | 12 +++++ tests/test_imports.py | 100 +++++++++++++++++++++++++++++++++++++++++ uafgi/__init__.py | 0 uafgi/util/__init__.py | 0 4 files changed, 112 insertions(+) create mode 100644 setup.py create mode 100644 tests/test_imports.py create mode 100644 uafgi/__init__.py create mode 100644 uafgi/util/__init__.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..43449a4 --- /dev/null +++ b/setup.py @@ -0,0 +1,12 @@ +from setuptools import setup, find_packages + +setup( + name='uafgi', + version='0.0.1', + url='https://github.com/pism/uafgi', + author='Elizabeth Fisher', + author_email='eafischer2@alaska.edu', + description='Some tools for internal use in in research at UAF/GI', + packages=find_packages(), + python_requires='>3.8', +) \ No newline at end of file diff --git a/tests/test_imports.py b/tests/test_imports.py new file mode 100644 index 0000000..75186c0 --- /dev/null +++ b/tests/test_imports.py @@ -0,0 +1,100 @@ +from __future__ import print_function +from cdo import Cdo +from gdal import ogr, osr +from getpass import getpass +from numpy import ndarray, asarray +from osgeo import gdal +from osgeo import ogr, gdal +from osgeo import ogr, osr +from osgeo import osr +from osgeo import osr, ogr, gdal +from osgeo import osr#, ogr, gdal +from setuptools import setup, find_packages +from uafgi import checksum, giutil +from uafgi import earthdata +from uafgi import ioutil +from uafgi.functional import * +from uafgi.util import cdoutil, ncutil, functional, gdalutil, ogrutil +from uafgi.util import functional, cfutil, gdalutil +from uafgi.util import functional, ogrutil, cfutil, ncutil, gisutil +from uafgi.util import gdalutil, osrutil, pdutil +from uafgi.util import gicollections +from uafgi.util import gicollections, giutil +from uafgi.util import gisutil +from uafgi.util import ioutil +from uafgi.util import ioutil, gicollections +from uafgi.util import ncutil, giutil +from uafgi.util import pathutil, gicollections +from uafgi.util import shputil +from uafgi.util.checksum import hashup +from urllib.error import HTTPError, URLError +from urllib.parse import urlparse +from urllib.request import urlopen, Request, build_opener, HTTPCookieProcessor +from urllib2 import urlopen, Request, HTTPError, URLError, build_opener, HTTPCookieProcessor +from urlparse import urlparse +import argparse +import base64 +import bisect +import cartopy.crs +import cartopy.geodesic +import cf_units +import collections +import collections, re +import collections.abc +import contextlib +import copy +import datetime +import dggs.data +import dill +import doctest +import filecmp +import functools +import getopt +import glob +import hashlib +import importlib +import inspect +import itertools +import json +import json, subprocess +import math +import matplotlib +import matplotlib.cm +import matplotlib.colors +import matplotlib.font_manager +import matplotlib.pyplot as plt +import netCDF4 +import netCDF4, cf_units +import netrc +import numpy as np +import operator +import os +import os, pickle +import os, stat +import os.path +import pandas as pd +import pathlib +import pickle +import pyproj +import pytest +import re +import requests +import scipy.interpolate +import scipy.stats +import shapefile +import shapely +import shapely.geometry +import shapely.ops +import shutil +import signal +import ssl +import string +import struct +import subprocess +import sys +import tempfile +import time +import types +import uafgi.indexing +import weakref +import xml.etree.ElementTree as ET \ No newline at end of file diff --git a/uafgi/__init__.py b/uafgi/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/uafgi/util/__init__.py b/uafgi/util/__init__.py new file mode 100644 index 0000000..e69de29 From 36432236d8fb5146a2dc5a7d49337ad80cf57d55 Mon Sep 17 00:00:00 2001 From: Chris Waigl Date: Thu, 1 Dec 2022 13:38:06 -0900 Subject: [PATCH 2/6] added more stuff to gitignore --- .gitignore | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 64c853f..872a9b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,66 @@ __pycache__ *~ #*# -.DS_Store +*~ +*.nc +*.png +x.* +x +xx +xxx +*.mk/ +products/ +slurm*.out +*DS_Store +*.py[cod] +*$py.class + + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version From 618fd6d9c1dc9d6abd24f7e4920d6414cd036cea Mon Sep 17 00:00:00 2001 From: Chris Waigl Date: Sat, 10 Dec 2022 02:12:32 -0900 Subject: [PATCH 3/6] modified setup.py to enable install. testin123 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 43449a4..31e41ad 100644 --- a/setup.py +++ b/setup.py @@ -8,5 +8,5 @@ author_email='eafischer2@alaska.edu', description='Some tools for internal use in in research at UAF/GI', packages=find_packages(), - python_requires='>3.8', + python_requires='>=3.8', ) \ No newline at end of file From 5f94ef589e0a12bdb466c8ac186734ad0347027e Mon Sep 17 00:00:00 2001 From: Chris Waigl Date: Wed, 4 Jan 2023 20:51:32 -0900 Subject: [PATCH 4/6] Added comments to test_imports.py --- tests/test_imports.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/test_imports.py b/tests/test_imports.py index 75186c0..2c8de25 100644 --- a/tests/test_imports.py +++ b/tests/test_imports.py @@ -1,6 +1,7 @@ from __future__ import print_function from cdo import Cdo -from gdal import ogr, osr +# from gdal import ogr, osr DEPRECATED +from osgeo import ogr, osr, gdal from getpass import getpass from numpy import ndarray, asarray from osgeo import gdal @@ -8,12 +9,12 @@ from osgeo import ogr, osr from osgeo import osr from osgeo import osr, ogr, gdal -from osgeo import osr#, ogr, gdal from setuptools import setup, find_packages from uafgi import checksum, giutil from uafgi import earthdata from uafgi import ioutil -from uafgi.functional import * +## from uafgi.functional import * DEPRECATED; also, a *-import: NOT PYTHONIC +from uafgi.util import functional from uafgi.util import cdoutil, ncutil, functional, gdalutil, ogrutil from uafgi.util import functional, cfutil, gdalutil from uafgi.util import functional, ogrutil, cfutil, ncutil, gisutil @@ -30,8 +31,11 @@ from urllib.error import HTTPError, URLError from urllib.parse import urlparse from urllib.request import urlopen, Request, build_opener, HTTPCookieProcessor -from urllib2 import urlopen, Request, HTTPError, URLError, build_opener, HTTPCookieProcessor -from urlparse import urlparse +# from urllib2 import urlopen, Request, HTTPError, URLError, build_opener, HTTPCookieProcessor - +# DEPRECATED in Python3. Use urllib. See https://stackoverflow.com/questions/2792650/import-error-no-module-name-urllib2 +from urllib import HTTPError, URLError, build_opener, HTTPCookieProcessor, urlopen +# from urlparse import urlparse - DEPRECATED in Python3. Use urlparse +from urllib import urlparse import argparse import base64 import bisect @@ -44,7 +48,7 @@ import contextlib import copy import datetime -import dggs.data +# import dggs.data <-- only used for WRF, not our ERA5 environment import dill import doctest import filecmp @@ -95,6 +99,6 @@ import tempfile import time import types -import uafgi.indexing +# import uafgi.indexing <-- this does not exist import weakref import xml.etree.ElementTree as ET \ No newline at end of file From e20196b4c6387fa05796cadd62e413531e360862 Mon Sep 17 00:00:00 2001 From: Chris Waigl Date: Mon, 30 Jan 2023 14:22:40 -0900 Subject: [PATCH 5/6] spelling correction --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 31e41ad..74a7696 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ name='uafgi', version='0.0.1', url='https://github.com/pism/uafgi', - author='Elizabeth Fisher', + author='Elizabeth Fischer', author_email='eafischer2@alaska.edu', description='Some tools for internal use in in research at UAF/GI', packages=find_packages(), From 687cb3e58917095dbc29ea15774db4ecb57c6298 Mon Sep 17 00:00:00 2001 From: Chris Waigl Date: Wed, 6 Sep 2023 15:56:28 -0800 Subject: [PATCH 6/6] new gitignore --- .gitignore | 100 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 87 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 872a9b5..6ad43ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,20 +1,21 @@ -__pycache__ -*~ -#*# -*~ -*.nc +# project-specific +.vscode +.DS* +._.DS* +*.zip *.png -x.* -x -xx -xxx -*.mk/ -products/ -slurm*.out -*DS_Store + +# hide data and output plots for the time being +data/GIS +plots + +# Byte-compiled / optimized / DLL files +__pycache__/ *.py[cod] *$py.class +# C extensions +*.so # Distribution / packaging .Python @@ -37,6 +38,12 @@ share/python-wheels/ *.egg MANIFEST +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + # Installer logs pip-log.txt pip-delete-this-directory.txt @@ -55,6 +62,29 @@ coverage.xml .hypothesis/ .pytest_cache/ +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + # Jupyter Notebook .ipynb_checkpoints @@ -64,3 +94,47 @@ ipython_config.py # pyenv .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/