NEFSC / READ-SSB-CHAJI-Effort-Displacement---Scallop

Other
0 stars 0 forks source link

knit_scallop_analysis_loop new shapefiles #192

Closed mchaji closed 1 year ago

mchaji commented 1 year ago

@mle2718 I added a "LEASE_NUMB" column to one of the new shapefiles to try and trouble shoot the error we were getting when running the analysis loop in the loop on scallop analysis branch #186 with no luck

Error: The following columns are not in the dataset: LEASE_NUMB

I noticed that the scallop0322MainDataTable drops the Lease Numb variable at some point which might be a part of the issue unless I missed something. Also the results that are printing with the old shapefiles have some gaps in them - not sure if this is a known issue though

image image

mle2718 commented 1 year ago

Error's at the same line of code?

what line of code drops the LEASE_NUMB? Can you try commenting that out, to see if it helps?

Not a known issue -- this could be happening if there's a filter.

Can you put the revised shapefile into this branch so I can try to replicate? Thanks?

mle2718 commented 1 year ago

For the images, I sometimes see this, depending on the figure. I suspect it's because of breaks, or because of the na.rm=TRUE option in the plot.

I believe the "missing" zones can be fixed by adjusting the calls to the plots. Taking care of this should wait until after the first draft is circulated.

mle2718 commented 1 year ago

what line of code drops the LEASE_NUMB? Can you try commenting that out, to see if it helps?

I don't think this is causing it. The scallop analysis code uses the "scallop0322WindCloseSpatTable" to assign a closure area at line 600. If this line is failing, it has to be because LEASE_NUMB is not in the dataset. Make sure that you re-run the "combine_cable_routes.Rmd" to reprocess the shapefiles into the .RDS files before trying to knit.

mle2718 commented 1 year ago

you can look at the scallop reports that I built at home2/mlee/Effort-Displacement---Scallop/results

mle2718 commented 1 year ago

I've pushed a small change to the knit_scallop_analysis_loop.Rmd that knits the combine_cable_routes.Rmd every time.

mchaji commented 1 year ago

what line of code drops the LEASE_NUMB? Can you try commenting that out, to see if it helps?

I don't think this is causing it. The scallop analysis code uses the "scallop0322WindCloseSpatTable" to assign a closure area at line 600. If this line is failing, it has to be because LEASE_NUMB is not in the dataset. Make sure that you re-run the "combine_cable_routes.Rmd" to reprocess the shapefiles into the .RDS files before trying to knit.

I'll try that after integrating your changes and let you know how that goes

mchaji commented 1 year ago

Error's at the same line of code?

what line of code drops the LEASE_NUMB? Can you try commenting that out, to see if it helps?

Not a known issue -- this could be happening if there's a filter.

Can you put the revised shapefile into this branch so I can try to replicate? Thanks?

I just checked and it should be in this branch

mle2718 commented 1 year ago

Error's at the same line of code? what line of code drops the LEASE_NUMB? Can you try commenting that out, to see if it helps? Not a known issue -- this could be happening if there's a filter. Can you put the revised shapefile into this branch so I can try to replicate? Thanks?

I just checked and it should be in this branch

It might be, but if so, it hasn't been pushed to github.

mchaji commented 1 year ago

Adding in the LEASE_NUMB column looks like it fixed the error when I changed one column name, but the loop still didn't work because I got a new error that I couldn't figure out. Quitting from lines 1733-1751 (scallop_analysis_0322.Rmd) Error in colour_ramp(colours) : Must provide at least one colour to create a colour ramp

I also quickly updated the shapefiles to have the LEASE_NUMB columns in all of them; plus I made some minor changes but held off on pushing anything.

mle2718 commented 1 year ago

@mchaji please push the shapefiles and whatever minor changes you have made directly to the 'loop' branch.

I've seen that error before, it's probably happening when one of the fishset functions tries to operate on a dataframe where nothing "matches."

Which set of parameters is failing? Hopefully it's failing on the wind_NY2.RDS run? If so, the way to troubleshoot is to set the params in scallop_analysis to

params: AA_DAS_only: TRUE subtrip_aggregate: TRUE BIN_GEARS: TRUE location: label: "Location:" value: Woods_Hole input: select choices: [Woods_Hole, Seattle] input_shapefile: value: "wind_NY2.RDS" choices: ["wind_sf_final.RDS","wind_sf_nocable.RDS","wind_NY1.RDS","wind_NY2.RDS","wind_NY3.RDS","wind_Central_Atlantic_1.RDS", "wind_Central_Atlantic_2.RDS"] PreRelease: TRUE

Then run until the offending line and see if you can figure out what's going on. I suspect 2 possibilities:

  1. It's the first time OPERATING_PROFIT_2020 gets used, so it's possible that column isn't being created properly. Maybe it doesn't get made or is null. Maybe I have a typo int there.
  2. There are no observations that are in the the wind_NY2 areas. Unlikely, because if this was happening, the code would fail somewhere else. I don't think it's a problem with the shapefiles. And I think the LEASE_NUMB has fixed the problem, because otherwise the code would throw an error earlier.

Please take a shot at troubleshooting this and let me know how it goes.

mle2718 commented 1 year ago

@mchaji I think this can now be closed.