josuemtzmo / trackeddy

Tracking eddy algorithm:
http://trackeddy.readthedocs.io/
MIT License
48 stars 18 forks source link

local variable 'eddz' referenced before assignment #18

Open JoMaHoPo opened 2 years ago

JoMaHoPo commented 2 years ago

Hello

I have been trying to run the analyseddyzt function in order to detect the positive eddies on a SLA subset (55,70 N; 30,5 W) from the CMEMS_SEALEVEL_008_057 dataset. I have selected one year, so it has 365 timesteps. I have also set the time and spatial filters to None.

However when I run the function the same error always pops up "local variable 'eddz' referenced before assignment". So I don't know how to proceed since I don't detect what I can be doing wrong or if any step is missing in applying the routine.

positive_eddies=analyseddyzt(sla,lon,lat,0,364,365,levels,preferences=preferences ,areamap=areamap,areaparms=checkarea,filters=filters ,maskopt='contour',diagnostics=False,pprint=True)

This error is repeated if I only choose one timestep from my dataset and use the same configuration as the How_TrakcEddy_Works script.

I have tried to look into the function script in order to see the possible mistake from my side, however, I have not found the reason.

Also, I was wondering if there is any function that calculates EKE, TEKE and TRKE and TRKEc since I am mostly interested in these variables.

Kind regards, Joan

JoMaHoPo commented 2 years ago

I have tried to run the Trackeddy with one day of global SLA. It worked. Is there any documented issue with using just a region of the ocean?

Thanks a lot for all the help so far!

josuemtzmo commented 2 years ago

Hello @JoMaHoPo, that seems like a weird issue, my guess is that it may have to do with the levels you are using:

Regarding the energy decomposition, first you need to reconstruct the surface anomaly from each field to then compute geostrophic velocities of each one of them. If I remember properly there is a function called reconstruct_syntetic that allows you to create the surface elevation.

JoMaHoPo commented 2 years ago

Hello Josue,

Yes, I was thinking the same, but what is intriguing me is that for the GLOBAL CMEMS dataset the function works as planned, but if my initial SLA field is a subset of that same global dataset, the function crashes giving me this error all the time. Could it have something to do with the fact that my longitude goes from -180 to 180? Or the fact that I my data is all located in all negative longitudes?

Regarding the reconstruction of the fields, I realised about that just after writing the question (silly of me, I am sorry).

Also, do you know if from your papers you created a full time series of the global reconstructed fields, so at some point I could compare the results of the reconstructed fields and the EKE, TEKE, TRKE fields?

Thanks a lot for the help so far, and sorry for all trouble.

josuemtzmo commented 2 years ago

I don't think I hard coded something regarding the longitude. Since I have no clue, It will be easier if you provide me more info here, i.e. the range of your field, the region.

I have the dataset of the reconstructed fields, so of course, I could share this with you. If you want, we can have a call, so I can help with the model details as well. We can arrange that by email (josue.martinezmoreno@ifremer.fr).