matthiasdemuzere / w2w

A python tool that ingests WUDAPT information into WRF.
MIT License
40 stars 16 forks source link

Not enough natural land points in selected area #118

Closed magalietecher closed 1 year ago

magalietecher commented 1 year ago

Describe your issue

Hi everybody,

I succesfully use the sample data provided with the tutorial. When i use my data:

Seems you are using a LCZ map produced by https://lcz-generator.rub.de/ I therefor use the Gaussian filtered default 'LczFilter' layer --> Check LCZ integrity, in terms of class labels, projection and extent LCZ labels as expected (1 to 17) LCZ provided as WGS84 (EPSG:4326) LCZ domain is covering WRF domain --> Replace WRF urban LC with surrounding natural LC Looping through urban grid pixels: 4%|█▌ | 3031/83904 [00:58<25:59, 51.87it/s]

At 4% I have this error, i don't understand:

ERROR: Not enough natural land points in selected area

You chose to sample 45 pixels over an area of 2025 Increase NPIX_AREA. Traceback (most recent call last): File "/home/magalie/miniconda3/lib/python3.9/site-packages/pandas/core/indexes/range.py", line 345, in get_loc return self._range.index(new_key) ValueError: 0 is not in range The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/magalie/miniconda3/lib/python3.9/site-packages/w2w/w2w.py", line 547, in wrf_remove_urban mkd = data_luse_natland.iloc[:NPIX_NLC].luse.mode()[0] File "/home/magalie/miniconda3/lib/python3.9/site-packages/pandas/core/series.py", line 1007, in getitem return self._get_value(key) File "/home/magalie/miniconda3/lib/python3.9/site-packages/pandas/core/series.py", line 1116, in _get_value loc = self.index.get_loc(label) File "/home/magalie/miniconda3/lib/python3.9/site-packages/pandas/core/indexes/range.py", line 347, in get_loc raise KeyError(key) from err KeyError: 0

Exiting ...

I am working on Montpellier City and using WRF 4.3. I try the following comand like suggest to modify -n --npix-nlc = 1025

w2w ./output_montpellier LCZ_Montpellier.tif geo_em.d01.nc -n --npix-nlc

but I have this error :

usage: w2w [-h] [-V] [-b [...]] [-l] [-f] [-n] [-a] [--lcz-ucp LCZ_UCP] io_dir lcz_file wrf_file w2w: error: argument -n/--npix-nlc: expected one argument

Do you know how I could resolve this issue and modify arguments? I am novice in w2w and coding in general.. Any help would be appreciate, thank you in advance!

w2w --version

w2w 0.5.0

nc-config --all

WRF 4.3
netcdf-c-4.7.2
netcdf-fortran-4.5.2

Installed Packages

Traceback

No response

jkittner commented 1 year ago

duplicate #116

magalietecher commented 1 year ago

Hi, thank you for your answer, i check the solution and the #104 as well.

I increase NPIX_AREA but it did not work. With -a 10000 i have the same error as above and with -a 15000 or -a 12000 i have this new error:

Traceback (most recent call last): File "C:\Users\magal\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\magal\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\magal\AppData\Local\Programs\Python\Python310\Scripts\w2w.exe__main__.py", line 7, in File "C:\Users\magal\AppData\Local\Programs\Python\Python310\lib\site-packages\w2w\w2w.py", line 179, in main wrf_remove_urban( File "C:\Users\magal\AppData\Local\Programs\Python\Python310\lib\site-packages\w2w\w2w.py", line 525, in wrf_remove_urban ikd = using_kdtree(data_coord, min(luse.size, NPIX_AREA)) File "C:\Users\magal\AppData\Local\Programs\Python\Python310\lib\site-packages\w2w\w2w.py", line 459, in usingkdtree , index = tree.query(data[['x', 'y', 'z']], k=kpoints) File "C:\Users\magal\AppData\Local\Programs\Python\Python310\lib\site-packages\scipy\spatial_kdtree.py", line 475, in query d, i = super().query(x, k, eps, p, distance_upper_bound, workers) File "_ckdtree.pyx", line 807, in scipy.spatial._ckdtree.cKDTree.query numpy.core._exceptions._ArrayMemoryError: Unable to allocate 22.4 GiB for an array with shape (250000, 12000) and data type int64

Do you think it can be link to the urban grid pixel? Mine is approximately 84000.

Thank you again,

Magalie.

magalietecher commented 1 year ago

Hi, Little update, I finally find an answer. I did not have enough storage memory to calculate the w2w products because of the high resolution (100m) of my simulation domain.

I try with lower (200m-1000m) and it works fine.

Magalie