-
Notifications
You must be signed in to change notification settings - Fork 315
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
Output of sowing and harvest dates #1537
Comments
I see now that the existing code already should set crop phase to 4 upon harvest, even when harvesting due to maximum growing season length instead of reaching maturity. This is a bit confusing to me, as I'm seeing Regardless, I think my proposed |
@samsrabin both byte and short are allowed on NetCDF. Typically byte is only used for character strings. In CTSM we don't allow for short, but you could add it to the allowed option (because ncdio_pio.F90.in specifies what the options are). I think byte might be more difficult to make sure you distinguish it for character strings. Because integer's already take up less space than floating point, I'm not sure there's a really compelling reason to use short integers. We have so much more floating point data than integer. And to save memory that integer data would need to be large arrays, which we don't have that many of. A refinement that I think would be worthwhile would be to convert some of the floating point data that we have that really should be integer though. So I'm not convinced this would be important to do. But, it looks like adding short's should'n't be hard either. But if you were to actually try to do it, I wouldn't be surprised if you ran into issues, as you find hidden assumptions. |
@samsrabin I'm not clear on how you plan to use these outputs to determine the actual date of the events. Does this rely on daily output of the relevant variables? The fact that you're seeing values between 3 and 4 does seem like a time-averaging issue. I'm just wondering if it might be more straightforward – at least for post-processing / analysis, and maybe in the code as well – if you had variables like PLANTING_DATE and HARVEST_DATE and stored the actual day of year in these variables at the time when planting / harvest happened. Then you could just do annual output of these variables. Or am I missing something that makes it straightforward to extract planting & harvest date with your plan without requiring frequent output? @danicalombardozzi can you comment on whether & how you have extracted planting & harvest date information in the past? |
@billsacks Yeah, that's how I was planning to determine the dates. I figured this would be an elegant solution to deal with eventual multiple plantings or harvests in a single year, although I guess that could also be accomplished using a "number of events" dimension on separate, annual planting and harvest variables. If you think that makes more sense, could you point me towards somewhere in the code something similar happens? I'm not familiar with any annual output variables, or any outputs with a dimension other than time. |
You should do what you feel makes most sense in terms of post-processing / analysis, but my somewhat outsider view on this is that a set of annually-output date variables – yes, with an extra "number of events" dimension – would both be more straightforward to analyze and be more efficient in terms of output volume. But I could be wrong. At first I thought you could avoid having the "number of events" dimension for now, but now I'm realizing that for SH / tropical crops that might be needed even now (with a max size of 2) to accommodate (for example) a planting in early Jan and then another one in late Dec, which I think can happen now, at least with the prognostic planting dates (I forget the outcome of the long discussion we had about this for prescribed planting dates). So I can see how the logic wouldn't be totally straightforward for filling this diagnostic variable... probably something like this (maybe this is already clear to you, but I'm thinking out loud):
For outputting a multi-dimension variable, this is as good an example as any: CTSM/src/biogeophys/SurfaceAlbedoType.F90 Line 192 in 7a85024
You will first need to add this new dimension as one of the allowable choices in histFileMod.F90; search for 'numrad' in that module and follow the example (there are a handful of places where you need to add references to your new dimension). To have annual output, I think the best thing to do is:
I'll let you judge whether this all feels easier or harder – both for initial development and from the user perspective – than your original plan. |
@billsacks I've given this a go, and I think I'm running into issues because this I made it an instantaneous variable (
What do you think? Are there any ideas I'm missing? |
Oh, good point about needing to use This may be more efficient to work out in person or over Zoom. I just invited you to our weekly "stand-up" meeting this afternoon. We could discuss it then if that time works for you, or you can send me an invite for another time - 3:30 - 4:30 today, or sometime tomorrow. |
|
As part of my work on #519, I need to extract planting and harvest dates from the output of every crop in every gridcell. Initially I've been determining these by looking at when output
CPHASE
(i.e., membercphase_patch
ofcrop_type
) either reaches 4 (harvest date) or is reset from 4 back down to 1 (sowing date). However, this will presumably fail when harvest occurs because the maximum growing season length has been reached. In extreme cases, crop phase could be 1 throughout the year, making it useless for this purpose.One option would be for me to simply set crop phase to 4 upon harvest, but this seems likely to eventually cause confusion. I'd like it to be obvious when a crop wasn't actually mature at "harvest."
I think the most flexible and efficient way to do this—i.e., allowing for eventual code allowing multiple growing seasons per year, while also minimizing output storage requirements—would be to create a single new
crop_event
variable incrop_type
for each patch. This could be 1 on the sowing date, 2 on the harvest date, and 0 otherwise. We could even distinguish between harvest reasons: 2 if harvested upon reaching maturity, and 3 if harvested upon reaching maximum growing season length (or butting up against the next sowing date).Related: Is there any way to save a variable to netCDF as type byte or short? This would help save space on small integer outputs like this.
The text was updated successfully, but these errors were encountered: