diff --git a/environments/ich-env-win.yml b/environments/ich-env-win.yml new file mode 100644 index 0000000000000000000000000000000000000000..c4775e99c5cf78913ee29d4b9ff85b8b59f7e4f9 --- /dev/null +++ b/environments/ich-env-win.yml @@ -0,0 +1,73 @@ +name: ich-env +channels: + - conda-forge + - defaults +dependencies: + - blosc=1.21.6 + - bzip2=1.0.8 + - ca-certificates=2024.9.24 + - freexl=2.0.0 + - gdal=3.9.2 + - geos=3.13.0 + - geotiff=1.7.3 + - intel-openmp=2024.2.1 + - krb5=1.21.3 + - lerc=4.0.0 + - libarchive=3.7.4 + - libblas=3.9.0 + - libcblas=3.9.0 + - libcurl=8.10.1 + - libdeflate=1.22 + - libexpat=2.6.3 + - libffi=3.4.4 + - libgdal-core=3.9.2 + - libhwloc=2.11.1 + - libiconv=1.17 + - libjpeg-turbo=3.0.0 + - libkml=1.3.0 + - liblapack=3.9.0 + - libpng=1.6.44 + - librttopo=1.1.0 + - libspatialite=5.1.0 + - libsqlite=3.46.1 + - libssh2=1.11.0 + - libtiff=4.7.0 + - libwebp-base=1.4.0 + - libxml2=2.12.7 + - libzlib=1.3.1 + - lz4-c=1.9.4 + - lzo=2.10 + - minizip=4.0.6 + - mkl=2024.1.0 + - numpy=2.1.2 + - openssl=3.3.2 + - pcre2=10.44 + - pip=24.2 + - proj=9.5.0 + - pthreads-win32=2.9.1 + - python=3.10.15 + - python_abi=3.10 + - setuptools=75.1.0 + - snappy=1.2.1 + - sqlite=3.45.3 + - tbb=2021.13.0 + - tk=8.6.13 + - tzdata=2024b + - ucrt=10.0.22621.0 + - uriparser=0.9.8 + - vc=14.40 + - vc14_runtime=14.40.33810 + - vs2015_runtime=14.40.33810 + - wheel=0.44.0 + - xerces-c=3.2.5 + - xz=5.4.6 + - zlib=1.3.1 + - zstd=1.5.6 + - pip: + - colorama==0.4.6 + - empatches==0.2.3 + - packaging==24.1 + - python-dateutil==2.9.0.post0 + - pytz==2024.2 + - six==1.16.0 +prefix: C:\Users\nbhogapurapu\.conda\envs\ich-env diff --git a/src/ich/__pycache__/algo.cpython-310.pyc b/src/ich/__pycache__/algo.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0535df8f8f579b7ed10090f39bb9b9ff9fdff371 Binary files /dev/null and b/src/ich/__pycache__/algo.cpython-310.pyc differ diff --git a/src/ich/__pycache__/args_in.cpython-310.pyc b/src/ich/__pycache__/args_in.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..28a51a332587afa620a45f2625518e47917a22bf Binary files /dev/null and b/src/ich/__pycache__/args_in.cpython-310.pyc differ diff --git a/src/ich/__pycache__/plotting.cpython-310.pyc b/src/ich/__pycache__/plotting.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..18e6f194e092817b5c38a3f9c23a05a84bf490af Binary files /dev/null and b/src/ich/__pycache__/plotting.cpython-310.pyc differ diff --git a/src/ich/__pycache__/rst_io.cpython-310.pyc b/src/ich/__pycache__/rst_io.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2518670d4097a85851354dd8f474301d7307a88e Binary files /dev/null and b/src/ich/__pycache__/rst_io.cpython-310.pyc differ diff --git a/src/ich/__pycache__/utils.cpython-310.pyc b/src/ich/__pycache__/utils.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..eb73f28196990210072efb2325d07b429e471dad Binary files /dev/null and b/src/ich/__pycache__/utils.cpython-310.pyc differ diff --git a/src/ich/algo.py b/src/ich/algo.py index f457595751430e7f3e0fd4e4c94b805cc767c310..bca2d9b46f538d9624adb92bdbec20018a1e0236 100644 --- a/src/ich/algo.py +++ b/src/ich/algo.py @@ -146,10 +146,10 @@ def arc_sinc_vectorized(x, c_param): # Clip the result to ensure non-negative values return np.clip(y, 0, None) -def cal_(cor, gedi, htl, htg): +def cal_(temp_cor, temp_gedi, htl, htg): try: - temp_cor = cor.copy() - temp_gedi = gedi.copy() + # temp_cor = cor.copy() + # temp_gedi = gedi.copy() nn = np.count_nonzero(~np.isnan(temp_cor)) result = [] @@ -243,7 +243,18 @@ def process_block(i, j, cohArray, lidarArray, initial_ws, htl, htg, parm_): lidarBlock = lidarArray[start_i:end_i, start_j:end_j] cohBlock = cohArray[start_i:end_i, start_j:end_j] - if np.isfinite(lidarBlock).any() and np.count_nonzero(~np.isnan(lidarBlock)) > 1: + if np.count_nonzero(~np.isnan(cohBlock)) <5: + count = np.count_nonzero(~np.isnan(lidarBlock)) + s_parm = 0 + c_parm = 0 + rmse_parm = 0 + ht = np.zeros(cohBlock.shape) + # print(lidarBlock.shape) + return start_i, end_i, start_j, end_j, s_parm, c_parm, rmse_parm, ht, count + + # elif (np.isfinite(lidarBlock).any() and np.count_nonzero(~np.isnan(lidarBlock)) > 1) or max(lidarBlock.shape)>512: + elif (np.isfinite(lidarBlock).any() and np.count_nonzero(~np.isnan(lidarBlock)) > 1) or max(lidarBlock.shape)>512: + parm = cal_(cohBlock, lidarBlock, htl, htg) mask = np.where(~np.isnan(lidarBlock), 1, 0) @@ -263,7 +274,7 @@ def process_block(i, j, cohArray, lidarArray, initial_ws, htl, htg, parm_): gama = cohBlock / parm[1] ht = arc_sinc(gama, parm[2]) * mask # ht = arc_sinc_fast(gama, parm[2]) * mask - + # print(lidarBlock.shape) return start_i, end_i, start_j, end_j, s_parm, c_parm, rmse_parm, ht, count else: S += 2 @@ -286,20 +297,27 @@ def dynamicWindow(cohArray, lidarArray, initial_ws, htl, htg): parm_ = [0, 0, 0, 0, 0] - num_workers = min(16, os.cpu_count()) + num_workers = os.cpu_count()-1 + futures = [] with ProcessPoolExecutor(max_workers=num_workers) as executor: - futures = [] for i in range(0, rows, initial_ws): for j in range(0, cols, initial_ws): futures.append(executor.submit(process_block, i, j, cohArray, lidarArray, initial_ws, htl, htg, parm_)) - for future in as_completed(futures): - start_i, end_i, start_j, end_j, s_p, c_p, r_p, ht, cnt = future.result() - s_parm[start_i:end_i, start_j:end_j] = s_p - c_parm[start_i:end_i, start_j:end_j] = c_p - rmse_parm[start_i:end_i, start_j:end_j] = r_p - ht_[start_i:end_i, start_j:end_j] = ht - count[start_i:end_i, start_j:end_j] = cnt + # Initialize the progress bar with the total number of futures + with tqdm(total=len(futures)) as pbar: + completed_jobs = 0 + for future in as_completed(futures): + start_i, end_i, start_j, end_j, s_p, c_p, r_p, ht, cnt = future.result() + s_parm[start_i:end_i, start_j:end_j] = s_p + c_parm[start_i:end_i, start_j:end_j] = c_p + rmse_parm[start_i:end_i, start_j:end_j] = r_p + ht_[start_i:end_i, start_j:end_j] = ht + count[start_i:end_i, start_j:end_j] = cnt + + completed_jobs += 1 + if completed_jobs % 100 == 0: # Update every 100 jobs + pbar.update(100) return s_parm, c_parm, rmse_parm, ht_, count