Skip to content

Commit

Permalink
Merge pull request #174 from carbonplan/pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
[pre-commit.ci] pre-commit autoupdate
  • Loading branch information
maxrjones authored May 26, 2023
2 parents 4966c6a + 0181269 commit 6056924
Show file tree
Hide file tree
Showing 13 changed files with 8 additions and 27 deletions.
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ci:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -14,20 +14,20 @@ repos:
- id: mixed-line-ending

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.3.2
hooks:
- id: pyupgrade
args:
- '--py38-plus'

- repo: https://github.com/psf/black
rev: 22.8.0
rev: 23.3.0
hooks:
- id: black
- id: black-jupyter

- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.0.0
hooks:
- id: flake8

Expand All @@ -36,17 +36,17 @@ repos:
hooks:
- id: seed-isort-config
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v3.0.0-alpha.0'
rev: 'v3.0.0-alpha.9-for-vscode'
hooks:
- id: prettier
files: "\\.(\
Expand All @@ -61,7 +61,7 @@ repos:
)$"

- repo: https://github.com/pre-commit/mirrors-prettier
rev: 'v3.0.0-alpha.0'
rev: 'v3.0.0-alpha.9-for-vscode'
hooks:
- id: prettier
name: prettier-markdown
Expand Down
1 change: 0 additions & 1 deletion carbonplan_data/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


def get_cf_global_attrs(**attrs):

if "history" not in attrs:
attrs["history"] = f"Created: {time.ctime(time.time())}"

Expand Down
5 changes: 0 additions & 5 deletions carbonplan_data/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,13 @@ def upload(src, target, bucket="carbonplan-data"):


def get_sources():

with open(root / "sources.yaml") as f:
sources = yaml.load(f, Loader=yaml.FullLoader)

return sources


def get_workdir(workdir):

# fallback to cwd
if workdir is None:
workdir = os.getcwd()
Expand All @@ -148,14 +146,12 @@ def get_workdir(workdir):


def process_sources(name, workdir=None):

sources = get_sources()
workdir = get_workdir(workdir)

results = {"download": [], "unzip": []}

for key, dset in sources[name]["data"].items():

# download
if "download" in dset["actions"]:
for url in dset["urlpath"]:
Expand Down Expand Up @@ -212,7 +208,6 @@ def set_zarr_encoding(
compressor = numcodecs.get_codec(codec_config)

for k, da in ds.variables.items():

# maybe cast float type
if np.issubdtype(da.dtype, np.floating) and float_dtype is not None:
da = da.astype(float_dtype)
Expand Down
1 change: 0 additions & 1 deletion scripts/fia/01_raw_to_parquet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@
"\n",
"\n",
"def force_float32(fname):\n",
"\n",
" memmap = fname.stat().st_size > 1e8\n",
"\n",
" df = pd.read_csv(fname, engine=\"c\", low_memory=False, memory_map=memmap)\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/global-biomass/01_biomass_to_cogs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"}\n",
"\n",
"for skey, tkey in keys.items():\n",
"\n",
" # raw file\n",
" source = workdir / f\"Global_Maps_C_Density_2010_1763/data/{skey}.tif\"\n",
"\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/grids/make_grid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"outputs": [],
"source": [
"def extract_grid_coords(tiff_url):\n",
"\n",
" out_lon = {}\n",
" out_lat = {}\n",
"\n",
Expand Down
4 changes: 0 additions & 4 deletions scripts/mtbs/04_mtbs_perims_to_raster.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@
"outputs": [],
"source": [
"def rasterize_geom(geoms):\n",
"\n",
" r = rasterize(\n",
" [(geom, 1) for geom in geoms],\n",
" out_shape=shape,\n",
Expand Down Expand Up @@ -174,7 +173,6 @@
"\n",
"\n",
"def copy_to_fs(source, dst, fs):\n",
"\n",
" with open(source, \"rb\") as fsource:\n",
" with fs.open(dst, \"wb\") as fdst:\n",
" fdst.write(fsource.read())\n",
Expand Down Expand Up @@ -230,9 +228,7 @@
"dst_profile = cog_profiles.get(\"deflate\")\n",
"\n",
"for month in months:\n",
"\n",
" for name, df in [(\"lf\", perims_lf), (\"vlf\", perims_vlf)]:\n",
"\n",
" out_fname = (\n",
" f\"carbonplan-data/processed/mtbs/{region}/30m/{name}_{month.strftime('%Y.%m')}.tif\"\n",
" )\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/mtbs/05_monthly_downsampling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
"\n",
"for year in [2017]:\n",
" for region in [\"conus\"]:\n",
"\n",
" for fire in [\"vlf\"]:\n",
" files = [get_file(\"conus\", \"vlf\", year, month + 1)[\"source\"] for month in range(12)]\n",
" crs, extent = projections(\"albers\", region)\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/nlcd/01_nlcd_to_cogs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"\n",
"\n",
"def upload(src, target, bucket=\"carbonplan-data\"):\n",
"\n",
" storage_client = storage.Client(\"carbonplan\")\n",
" bucket = storage_client.bucket(bucket)\n",
" blob = bucket.blob(target)\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/prism/01_prism_to_cogs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
"target = \"./raster.tif\"\n",
"\n",
"for source in sources:\n",
"\n",
" for var in [\"ppt\", \"tmean\"]:\n",
" if var in source:\n",
" break\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/prism/02_downsample_and_reproject.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
" crs, extent = projections(\"albers\", region)\n",
"\n",
" for var in [\"ppt\", \"tmean\"]:\n",
"\n",
" print(region, var)\n",
"\n",
" source = f\"carbonplan-data/raw/prism/normals/{region}/800m/{var}.tif\"\n",
Expand Down
1 change: 0 additions & 1 deletion scripts/terraclimate/01_terraclimate_to_zarr3.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@
" return target_url\n",
"\n",
" with dask.config.set(scheduler=\"single-threaded\"):\n",
"\n",
" try:\n",
" ds = (\n",
" xr.open_dataset(fs.open(source_url), engine=\"h5netcdf\")\n",
Expand Down
1 change: 0 additions & 1 deletion web/intake-to-js.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


def main():

files = catalog_dir.glob("*yaml")

data = {}
Expand Down

0 comments on commit 6056924

Please sign in to comment.