Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with crop #770

Open
Jigyasu4indp opened this issue Sep 30, 2024 · 4 comments
Open

Error with crop #770

Jigyasu4indp opened this issue Sep 30, 2024 · 4 comments

Comments

@Jigyasu4indp
Copy link

fdt = a[:, :, 1]
╭─────────────────────╮
│ 720×360 RasterStack │
├─────────────────────┴────────────────────────────────────────────────── dims ┐
  ↓ X Mapped{Float64} [-179.75, -179.25, …, 179.25, 179.75] ForwardOrdered Regular Points,
  → Y Mapped{Float64} [89.75, 89.25, …, -89.25, -89.75] ReverseOrdered Regular Points
├────────────────────────────────────────────────────────────────────── layers ┤
  :exposure eltype: Union{Missing, Float32} dims: X, Y size: 720×360
├──────────────────────────────────────────────────────────────────── metadata ┤
  Metadata{Rasters.NCDsource} of Dict{String, Any} with 10 entries:
  "isimip_qc_pass_date"     => "2023-07-20 13:43 UTC"
  "contact"                 => "[email protected]"
  "history"                 => "Mon Apr 29 20:47:43 2024: cdo -f nc4c -z zip -L…
  "CDO"                     => "Climate Data Operators version 2.0.5 (https://m…
  "title"                   => "extreme events – low yields"
  "isimip_id"               => "8eb49fd7-0456-42f0-af40-a314a0587a39"
  "isimip_comment"          => "Data is taken from GGCMI (AgMIP) Phase 3a and r…
  "CDI"                     => "Climate Data Interface version 2.0.5 (https://m…
  "isimip_protocol_version" => "027342a3356372791ca6318f6bd552ee712cfd4a"
  "Conventions"             => "CF-1.6"
├────────────────────────────────────────────────────────────────────── raster ┤
  extent: Extent(X = (-179.75, 179.75), Y = (-89.75, 89.75))
  missingval: missing
  crs: EPSG:4326
  mappedcrs: EPSG:4326
└──────────────────────────────────────────────────────────────────────────────┘
first_geometry = dt[1, :geometry]
MultiPolyArea
└─ PolyArea((lat: 41.9963°, lon: 19.3843°), ..., (lat: 42.0317°, lon: 19.3691°))

# Extract the extent of the geometry
extent_geom = Rasters._extent(first_geometry)

# Crop the raster with respect to the extent
cropped_fdt = crop(fdt; to=extent_geom)
MethodError: objects of type EPSG{1} are not callable

Stacktrace:
@rafaqz
Copy link
Owner

rafaqz commented Sep 30, 2024

I really need the full stack trace, there is no way to know what this error is. Then, its best to make an MWE that just runs from pasting the code and hits the bug.

@rafaqz
Copy link
Owner

rafaqz commented Oct 2, 2024

Can you paste the stack trace?

@Jigyasu4indp
Copy link
Author

The crop issue was resolved due to the package version, but the mask issue still persists. MWE example link is https://drive.google.com/drive/folders/165tiReCHcFHuDH0zzEb0HsagrMEmv1p-?usp=sharing

@rafaqz
Copy link
Owner

rafaqz commented Oct 3, 2024

I won't have time to run an ipynotebook. I get a lot of these and answer in my free time

Can you please paste the code inline yere, make it download the file, and also paste the error right here.

Then I can spend all the time fixing bugs rather than getting set up to fix bugs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants