From 9069152801f611047fc5439165c826f9b3420bec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 06:45:51 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0) - [github.com/asottile/pyupgrade: v2.37.3 → v3.3.2](https://github.com/asottile/pyupgrade/compare/v2.37.3...v3.3.2) - [github.com/psf/black: 22.8.0 → 23.3.0](https://github.com/psf/black/compare/22.8.0...23.3.0) - [github.com/PyCQA/flake8: 5.0.4 → 6.0.0](https://github.com/PyCQA/flake8/compare/5.0.4...6.0.0) - [github.com/PyCQA/isort: 5.10.1 → 5.12.0](https://github.com/PyCQA/isort/compare/5.10.1...5.12.0) - [github.com/PyCQA/isort: 5.10.1 → 5.12.0](https://github.com/PyCQA/isort/compare/5.10.1...5.12.0) - [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.0 → v3.0.0-alpha.9-for-vscode](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0-alpha.0...v3.0.0-alpha.9-for-vscode) - [github.com/pre-commit/mirrors-prettier: v3.0.0-alpha.0 → v3.0.0-alpha.9-for-vscode](https://github.com/pre-commit/mirrors-prettier/compare/v3.0.0-alpha.0...v3.0.0-alpha.9-for-vscode) --- .pre-commit-config.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index eefa773..0209fa5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 @@ -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: "\\.(\ @@ -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 From 0181269f0478928f7c4da59e639c5cc0cba346e6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 06:46:03 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- carbonplan_data/metadata.py | 1 - carbonplan_data/utils.py | 5 ----- scripts/fia/01_raw_to_parquet.ipynb | 1 - scripts/global-biomass/01_biomass_to_cogs.ipynb | 1 - scripts/grids/make_grid.ipynb | 1 - scripts/mtbs/04_mtbs_perims_to_raster.ipynb | 4 ---- scripts/mtbs/05_monthly_downsampling.ipynb | 1 - scripts/nlcd/01_nlcd_to_cogs.ipynb | 1 - scripts/prism/01_prism_to_cogs.ipynb | 1 - scripts/prism/02_downsample_and_reproject.ipynb | 1 - scripts/terraclimate/01_terraclimate_to_zarr3.ipynb | 1 - web/intake-to-js.py | 1 - 12 files changed, 19 deletions(-) diff --git a/carbonplan_data/metadata.py b/carbonplan_data/metadata.py index 6d47a4e..618f227 100644 --- a/carbonplan_data/metadata.py +++ b/carbonplan_data/metadata.py @@ -10,7 +10,6 @@ def get_cf_global_attrs(**attrs): - if "history" not in attrs: attrs["history"] = f"Created: {time.ctime(time.time())}" diff --git a/carbonplan_data/utils.py b/carbonplan_data/utils.py index 1d1e889..1c0f0fb 100644 --- a/carbonplan_data/utils.py +++ b/carbonplan_data/utils.py @@ -124,7 +124,6 @@ def upload(src, target, bucket="carbonplan-data"): def get_sources(): - with open(root / "sources.yaml") as f: sources = yaml.load(f, Loader=yaml.FullLoader) @@ -132,7 +131,6 @@ def get_sources(): def get_workdir(workdir): - # fallback to cwd if workdir is None: workdir = os.getcwd() @@ -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"]: @@ -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) diff --git a/scripts/fia/01_raw_to_parquet.ipynb b/scripts/fia/01_raw_to_parquet.ipynb index 5fd0c97..3dc1556 100644 --- a/scripts/fia/01_raw_to_parquet.ipynb +++ b/scripts/fia/01_raw_to_parquet.ipynb @@ -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", diff --git a/scripts/global-biomass/01_biomass_to_cogs.ipynb b/scripts/global-biomass/01_biomass_to_cogs.ipynb index b5a81fa..1b8cfb5 100644 --- a/scripts/global-biomass/01_biomass_to_cogs.ipynb +++ b/scripts/global-biomass/01_biomass_to_cogs.ipynb @@ -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", diff --git a/scripts/grids/make_grid.ipynb b/scripts/grids/make_grid.ipynb index 97847c3..f2c4994 100644 --- a/scripts/grids/make_grid.ipynb +++ b/scripts/grids/make_grid.ipynb @@ -96,7 +96,6 @@ "outputs": [], "source": [ "def extract_grid_coords(tiff_url):\n", - "\n", " out_lon = {}\n", " out_lat = {}\n", "\n", diff --git a/scripts/mtbs/04_mtbs_perims_to_raster.ipynb b/scripts/mtbs/04_mtbs_perims_to_raster.ipynb index 373084b..9e9222e 100644 --- a/scripts/mtbs/04_mtbs_perims_to_raster.ipynb +++ b/scripts/mtbs/04_mtbs_perims_to_raster.ipynb @@ -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", @@ -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", @@ -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", diff --git a/scripts/mtbs/05_monthly_downsampling.ipynb b/scripts/mtbs/05_monthly_downsampling.ipynb index 4646b22..acc4809 100644 --- a/scripts/mtbs/05_monthly_downsampling.ipynb +++ b/scripts/mtbs/05_monthly_downsampling.ipynb @@ -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", diff --git a/scripts/nlcd/01_nlcd_to_cogs.ipynb b/scripts/nlcd/01_nlcd_to_cogs.ipynb index b8dc5b9..8604607 100644 --- a/scripts/nlcd/01_nlcd_to_cogs.ipynb +++ b/scripts/nlcd/01_nlcd_to_cogs.ipynb @@ -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", diff --git a/scripts/prism/01_prism_to_cogs.ipynb b/scripts/prism/01_prism_to_cogs.ipynb index 70738cc..234f467 100644 --- a/scripts/prism/01_prism_to_cogs.ipynb +++ b/scripts/prism/01_prism_to_cogs.ipynb @@ -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", diff --git a/scripts/prism/02_downsample_and_reproject.ipynb b/scripts/prism/02_downsample_and_reproject.ipynb index 443403a..00a2917 100644 --- a/scripts/prism/02_downsample_and_reproject.ipynb +++ b/scripts/prism/02_downsample_and_reproject.ipynb @@ -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", diff --git a/scripts/terraclimate/01_terraclimate_to_zarr3.ipynb b/scripts/terraclimate/01_terraclimate_to_zarr3.ipynb index 9a64856..19d8bdd 100644 --- a/scripts/terraclimate/01_terraclimate_to_zarr3.ipynb +++ b/scripts/terraclimate/01_terraclimate_to_zarr3.ipynb @@ -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", diff --git a/web/intake-to-js.py b/web/intake-to-js.py index 22be508..1264be3 100644 --- a/web/intake-to-js.py +++ b/web/intake-to-js.py @@ -12,7 +12,6 @@ def main(): - files = catalog_dir.glob("*yaml") data = {}