manipulating non-missing elements in a field
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- numpy, python, scikit-learn
- Lĩnh vực
- data
Hướng nghiên cứu
Bắt đầu bằng cách kiểm tra trường CF và các entry point của Data được đề cập trong báo cáo: compressed(), reshape(), get_data() và set_data(), bao gồm cách xử lý các mảng bị che và các mảng được dask hỗ trợ. Xác định các thao tác tiện ích mong muốn để trích xuất các giá trị không thiếu và gán kết quả, sau đó bổ sung coverage cho workflow 3D-to-2D và trường hợp kích thước chunk của dask chưa biết.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In order to use a scikit regression module, I need to
-
Extract the non-missing elements from a 3D field
fin(z,y,x) into a numpy array (z,p), where p is a 1D index over all the non-missing (y,x) locations, which are the same for every z. -
Put a 1D array of results
r(p) into the non-missing data elements of a 2D fieldfout(y,x).
I've done it as follows:
findata=fin.data.compressed().to_dask_array()
findata.compute_chunk_sizes()
findata=findata.reshape(fin.shape[0],fin[0,:].data.compressed().size)
# compute r from findata
foutdata=fout.get_data().flatten()
foutdata[~foutdata.mask]=r
fout.set_data(foutdata.reshape(fout.shape))
Are there better ways, or could you provide better ways? The following occur to me:
- It would be handy if
compressed()was a method of a CF field, to flatten it into a 1D array containing only the non-missing values. - I needed three lines to produce
findatabecause of having tocompute_chunk_sizeson the dask array. Without that step, I got errors as below. - Is there a way to avoid having to get the
Dataout of the field in order to assign to some elements of it using the mask? This was a bit clumsy.
In the Met O IDL lib, both input and output are easier:
findata=fin.data(where(fin(0).data ne fin(0).bmdi))
; compute r from findata
fout.data(where(fout.data ne fout.bmdi))=r
It would be good to have something equally convenient in cf-python. Perhaps there is?
Here's the dask problem:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/users/sws02jmg/.local/lib/python3.11/site-packages/cfdm/decorators.py", line 44, in inplace_wrapper
processed_copy = operation_method(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/users/sws02jmg/.local/lib/python3.11/site-packages/cf/data/data.py", line 10489, in reshape
dx = dx.reshape(*shape, merge_chunks=merge_chunks, limit=limit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/software/applications/anaconda/2023.09-0/lib/python3.11/site-packages/dask/array/core.py", line 2220, in reshape
return reshape(self, shape, merge_chunks=merge_chunks, limit=limit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/software/applications/anaconda/2023.09-0/lib/python3.11/site-packages/dask/array/reshape.py", line 222, in reshape
raise ValueError(
ValueError: Array chunk size or shape is unknown. shape: (nan,)
Possible solution with x.compute_chunk_sizes()
Thanks. Jonathan
- Ngôn ngữ chính
- Python
- Star
- 151
- Fork
- 23
- Merge trung bình
- 21 giờ 29 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NCAS-CMS/cf-python
-
Remove abandoned `cf.etc` directoryCó thể đã có người làm @sadielbartholomew đã nhận 27 ngày trước. Đang mởcode tidy
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
installation
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Attempt at unsupported conservative 3D mesh regriddingCó thể đã có người làm @sadielbartholomew đã nhận 25 ngày trước. Đang mởbug?
-
Release: migrate from deprecated build commandCó thể đã có người làm @sadielbartholomew đã nhận 27 ngày trước. Đang mởrelease
-
Remove support for Python 3.10 (EOL)Có thể đã có người làm @sadielbartholomew đã nhận 27 ngày trước. Đang mởenhancement
Tất cả issue của NCAS-CMS/cf-python
Issue tương tự
-
bug llm translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Arkansas 2025 tax is $1.70 high above $100,000 net taxable income ($3,809 + 3.9% rule)Có thể đã có người làm @PavelMakarchuk đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
PolicyEngine/policyengine-us#9828 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
jellyfin/jellyfin-mpv-shim#800 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
skillfs: one malformed chat-log line aborts the entire skill-usage analysis (skill_usage_from_chat_logs.py)Có thể đã có người làm @zjncs đã nhận hôm nay. Đang mởcomponent:skillfs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
agentic-os-org/ANOLISA#6116 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
P4: low query
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
jeffknupp/association#336 ·