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

Composite local time in GRIB message #6

Closed
sebvi opened this issue Mar 19, 2020 · 21 comments
Closed

Composite local time in GRIB message #6

sebvi opened this issue Mar 19, 2020 · 21 comments
Assignees
Milestone

Comments

@sebvi
Copy link
Contributor

sebvi commented Mar 19, 2020

Branch
https://github.com/wmo-im/GRIB2/tree/issue-06

~
In the context of Fire Forecasting, we are creating composite GRIB messages of several UTC time.

Typically, Fire forecasting (risk of fire) is only relevant during day time. Usually, when encoding a GRIB message, the time is UTC and fixed for the entire grid domain (which is ok most of the time). For Fire forecasting however, if we were using universal time, then the data value would be relevant only for part of the horizontal domain. For instance, 12Z will be relevant for Europe but will be useless for Australia.

One could save several GRIB messages for several UTC time so that all continents are covered at some point with relevant, meaningful values. But it is much more practical to create composite GRIB messages that are composed by stripes of local times so that the data represents for instance the values for "noon" everywhere.

Practically, depending on the resolution of the model, we create GRIB files with 4 stripes (6 hour zones), 8 stripes (3 hours zones), 12 stripes (2 hours zones) or 24 stripes (hourly zones). The stripes are perfect longitudinal time zones (not following countries like the time zones we usually know).

stripes_local_time

The bottom part shows an example of 8 stripes (3 hours timestep) for a forecast starting at 00Z. each stripes in longitudes 360/8 degrees wide, i.e. 45 degrees: 337.5 to 22.5 degrees is 00z+12 UTC, 22.5 to 67.5 degrees is 00Z + 09 UTC, .... 292.5 to 337.5 degrees is 00Z+15 UTC

My feeling is that I need a whole new set of templates in section 4 that do not represent "point in time" or "continuous or non continuous time interval" but a set of keys to represent "composite time".

Alternatively an entry could be added in code table 1.2 to specify that the time in section 2 is still the reference time of the forecast (that still needs to be recorded) but that the time specified in section 4 will be a composite. The problem then is that I don't know how to specify the number of "stripes" which should also be recorded.

If anyone have suggestions, comments, alternatives?

@sebvi
Copy link
Contributor Author

sebvi commented Mar 30, 2020

Please @wmo-im/tdcf have a look at this proposal :)

@sebvi sebvi added this to the IPET-CM IV milestone Apr 17, 2020
@sebvi
Copy link
Contributor Author

sebvi commented Apr 22, 2020

@wmo-im/tdcf I have updated the issue with a picture and some extra explanations. Feedback, ideas are most welcome because we need to find the proper way to describe the metadata.

@efucile efucile removed this from the IPET-CM IV milestone Apr 28, 2020
@ckpan-hko
Copy link

It's a good idea from user's perspective. But for GRIB products carrying global data, I think one single time domain would be better.

@efucile
Copy link
Member

efucile commented Apr 29, 2020

If I understand correctly there is a connection between time and grid. We can see it in different ways, but the connection is there. For different time steps we need to define a different slice of a global grid, connected with a different slice of data in the data section. This is very complex in GRIB and would require a careful implementation in the decoders. Not impossible, only very complex.

@sebvi
Copy link
Contributor Author

sebvi commented Apr 29, 2020

Yes it is very complex! This is why I wanted an open discussion first before digging into this!

I could try to propose new sets of templates but it will be too short time to do so and too short notice to reasonably discuss it tomorrow. With the new github workflow, it seems much easier to me to consider approving requests more frequently than twice a year.

@ckpan-hko
Copy link

If we see "time" as a parameter with "UTC" as its base unit, does it mean that the "time" in different strips carries different unit?

@efucile efucile modified the milestones: FT-2020-2, FT-2021-1 May 1, 2020
@sebvi
Copy link
Contributor Author

sebvi commented Oct 20, 2020

UPDATE

We continued to work on this proposal and here is where we are:

purpose of the proposal: Generate a template which allows to store an instantaneous field at a given local time using an appropriate forecast window to collate different UTC times

The simpler way to achieve this for each grid point and for a given solar/local time, is to:

  1. calculate what is the exact UTC time at this location that corresponds to the chosen solar time
  2. select grid point data (eg. Temperature) from a set of forecast step that is closest in UTC time to the exact calculated UTC time
    Following these simple rules, stripes of data are created and collated together. The better the time resolution of the input forecast, the narrower the stripes become and the less approximate is the solution. Basically We obtain schematically what is in the figures of the original post of this proposal.

However, this simple method generates artifacts as shown below with temperature where the strips are still visible (over Africa for instance).
image

A way to mitigate this is by interpolating data values to the given local time from the two closest UTC time steps as shown by the example below where a zoom is performed on one of the discontinuities.

time_interpolation

The temperature field is interpolated in the plot on the right and is simply concatenated (stripes) in the plot on the left. If we look at two points, 1 and 2, very close to the discontinuity and plot the time serie of the 24 hours forecast, in the case of the concatenation, those points will be attributed temperature from two different time stamps. Instead in the case of the interpolation values from two nearest time stamps are interpolated leading to a more accurate result.

image

image

Proposal

  1. add a new entry in Code Table 1.2 Significance of reference time: "4 - Local Time" with a note explaining that the grid points represents the value of the parameters for the local time encoded in the reference time of the message. "local Time" should be used together with specific products Definition Templates in section 4 designed to be used with it and specifying how the data points were obtained and from which forecast steps.

  2. create a products definition template in section 4 that describes what are the forecasts steps used and what methods has been used to obtain the parameter value (nearest forecast step (stripes), time interpolation, etc.)

We are in the process of drafting the template.

@sebvi
Copy link
Contributor Author

sebvi commented Nov 9, 2020

Proposal

add a new entry in Code table 1.2 Significance of reference time

Code Meaning
4 Local Time

add in Code Table 4.0 an entry for the new template

Code Meaning
88 Analysis or Forecast at a horizontal level or in a horizontal layer at a local Time

add a new Product definition template 4.88 - Analysis or Forecast at a horizontal level or in a horizontal layer at a local Time

Octet No. Contents
10 Parameter category (see Code table 4.1)
11 Parameter number (see Code table 4.2)
12 Type of generating process (see Code table 4.3)
13 Background generating process identifier (defined by originating centre)
14 Forecast generating process identifier (defined by originating centre)
15 Type of first fixed surface (see Code table 4.5)
16 Scale factor of first fixed surface
17–20 Scaled value of first fixed surface
21 Type of second fixed surface (see Code table 4.5)
22 Scale factor of second fixed surface
23–26 Scaled value of second fixed surface
27 Method used to calculate the field value at the local time specified in section 1 (see Code table 4.248)
28 n - number of forecasts used in the processing
n/a 29-46 Specification of the first forecast used in the processing (reference date, reference time and forecast time increments)
29-30 Year of the reference date for the first forecast used in the processing
31 Month of the reference date for the first forecast used in the processing
32 Day of the reference date for the first forecast used in the processing
33 Hour of the reference time for the first forecast used in the processing
34 Minute of the reference time for the first forecast used in the processing
35 Second of the reference time for the first forecast used in the processing
36 Indicator of units of forecast time (see Code table 4.4)
37-40 Forecast time for the first forecast used in the processing, in units defined by the previous octet
41 Number of time increments for the first forecast used in the processing
42 Indicator of unit of time for the time increment between the successive forecast times used in the processing (see Code table 4.4)
43-46 Time increment between successive forecast times, in units defined by the previous octet
n/a 47-nn These octets are included only if n>1 where nn=28+18*n
47-nn (n-1) repetitions of sequence of octet 29-46, describing the next forecasts used in the processing (reference date, reference time and forecast time increments)

create a new Code Table 4.248 Method used to derive the data values for a given local time

Code figure Meaning
0 Nearest forecast time to local time
1 Interpolated to be valid at the specified local time
2-191 Reserved
192 - 254 Reserved for local use
255 Missing

@SimonElliottEUM
Copy link

Left hand column of Code table 4.248 above should be "Code figure" rather than "Octet". But otherwise this look plausible to me

@shahramn
Copy link

Octet 28 : "n - number of forecast used in the processing"
should read
"n - number of forecasts used in the processing"

@sebvi
Copy link
Contributor Author

sebvi commented Nov 10, 2020

thank you @SimonElliottEUM and @shahramn , I have edited my proposal following your comments.

@sebvi
Copy link
Contributor Author

sebvi commented Nov 23, 2020

I could not find a branch "issue-06" for this issue, any chance to create one?

@amilan17
Copy link
Member

I could not find a branch "issue-06" for this issue, any chance to create one?

https://github.com/wmo-im/GRIB2/tree/issue-06

@sebvi
Copy link
Contributor Author

sebvi commented Dec 8, 2020

@wmo-im/tt-tdcf : I would be grateful if others could comment on this proposal ahed of tomorrow's meeting. I will provide some sample files encoded with this template today.

During the final review of the proposal we realized that it would be useful to provide an additional template with the possibility to encode statistically processed fields. In the context of fire forecasting it is useful to provide the total precipitation during the 24 hours preceding the local time encoded. I will provide the template later today and would be extremely grateful if it can be reviewed before tomorrow's meeting.

@sebvi
Copy link
Contributor Author

sebvi commented Jan 15, 2021

I tried to upload a sample for this template, not sure it worked properly as I don't see it anywhere

@jitsukoh
Copy link

@sebvi I don't see sample data. I'd appreciate anyone's help in validation but there is not decoder available, could you provide a decode output of ecCodes to complete the validation process? I understand that the use of products encoded using this new template will be limited to users of ecCodes at this moment and therefore there is no reason not to approve it because there are no other decoders available. Please comment if there is objection.

@sebvi
Copy link
Contributor Author

sebvi commented Jan 18, 2021

Yes @jitsukoh I can definitely do that! I was hoping @amilan17 could find out why I can't upload files

@amilan17
Copy link
Member

@sebvi -- I was able to upload this file after changing this box to support markdown. Can you try again? If it still doesn't work, then the file may be too large... (25 MB max)
image

@sebvi
Copy link
Contributor Author

sebvi commented Jan 21, 2021 via email

@sebvi
Copy link
Contributor Author

sebvi commented Jan 22, 2021

it does not seem to work for me... it worked before because I could attach pictures in this issue.

I will try to send as attachment in an email, maybe this trick will work

@sebvi
Copy link
Contributor Author

sebvi commented Jan 22, 2021

here is a sample implementing PDT 88. I remove the bipmap and data section to reduce size
PDT88_ECMWF.zip

and here is a dump of the sample using ecCodes:
PDT88_ECMWF.txt

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

7 participants