Skip to main content

Dear FME Users,

 

 

I’d like to process 73 input NetCDF-files. The files describe 3 days (73 hours). Every single file stands for one hour. The NetCDF-files don’t include any useful time attribute.

 

 

What I need is the timestamp for every single input written in an attribute .The data type should be “date”.

 

 

In the following you can take a look to the assignments (input files -> time):

 

- HRES_ENS_2017062200+019 -> June 22, 2017 “07:00 p.m.”

 

- HRES_ENS_2017062200+025 -> June 23, 2017 “07:00 a.m.”

 

- HRES_ENS_2017062200+071 -> June 24, 2017 “11:00 p.m.”

 

 

What I can do in FME is to extract the substrings I need (e.g. “2017-06-22-19”).

 

 

I’ve tried following transformers too: “DateFormatter”, “DateTimeCalculator” and “TimeStamper”.

 

 

Do you’ve an idea how to solve it?

 

 

Thank you very much and best regards!

 

 

Konrad

Hi @UBA_KP,

I created the Workspace file and the result is:

Please see attachment.

Thanks,

Danilo-workspace-string.fmw


Thank you very much @danilo_inovacao. The attribut "_result" has the data type "date"?

How can I solve this problem? --> HRES_ENS_2017062200+071 -> June 24, 2017 “11:00 p.m.”


Thank you very much @danilo_inovacao. The attribut "_result" has the data type "date"?

How can I solve this problem? --> HRES_ENS_2017062200+071 -> June 24, 2017 “11:00 p.m.”

Hello @UBA_KP,

 

 

About your request, would you like to have this format ( 2017-06-22-19 ) in which attribute:

 

 

this HRES_ENS_2017062200+071? or this June 24, 2017 “11:00 p.m.”?

 

 

Thanks

 

 

 


Hello @UBA_KP,

 

 

About your request, would you like to have this format ( 2017-06-22-19 ) in which attribute:

 

 

this HRES_ENS_2017062200+071? or this June 24, 2017 “11:00 p.m.”?

 

 

Thanks

 

 

 

I've this: HRES_ENS_2017062200+071

 

And I'd like to have this: June 24, 2017 “11:00 p.m

 

 

Thank you very much!

 


I've this: HRES_ENS_2017062200+071

 

And I'd like to have this: June 24, 2017 “11:00 p.m

 

 

Thank you very much!

 

Perfect.

 

How can i get the number 24 in ( 2017062200+071 ) What is the rule?

 

 

thanks

 

 


Hi @UBA_KP, if I understand your requirement correctly, this procedure might help you.

1. StringSearcher - Extract YYYYmmddHH and hours that should be added.

  • Contain Regular Expression: (\\d+)\\+(\\d+)
  • Subexpression Matches List Name: _list
2. DateTimeCalculator - Get desired datetime in the format YYYYmmddHHMMSS.
  • Mode: Add or Subtract Interval
  • Datetime: @Value(_list{0}.part)0000
  • Operator: Add
  • Hours: _list{1}.part
3. DateFormatter - Format the datetime string.
  • Source Date Format: %Y%m%d%H%M%S (or "Unknown - Automatic Detection")
  • Destination Date Format: %B %d, %Y \\"%I:%M %p\\"
4. StringPairReplacer: Replace "AM" and "PM" with "a.m." and "p.m."
  • Replacement Pairs: AM a.m. PM p.m.


Why should 00+025 hours be 07:00 a.m.?

 

HRES_ENS_2017062200+025 -> June 23, 2017 “07:00 a.m.”

 


Why should 00+025 hours be 07:00 a.m.?

 

HRES_ENS_2017062200+025 -> June 23, 2017 “07:00 a.m.”

 

Sorry it's a mistake, it should be "01:00 a.m".

 

 


Hi @UBA_KP, if I understand your requirement correctly, this procedure might help you.

1. StringSearcher - Extract YYYYmmddHH and hours that should be added.

  • Contain Regular Expression: (\\d+)\\+(\\d+)
  • Subexpression Matches List Name: _list
2. DateTimeCalculator - Get desired datetime in the format YYYYmmddHHMMSS.
  • Mode: Add or Subtract Interval
  • Datetime: @Value(_list{0}.part)0000
  • Operator: Add
  • Hours: _list{1}.part
3. DateFormatter - Format the datetime string.
  • Source Date Format: %Y%m%d%H%M%S (or "Unknown - Automatic Detection")
  • Destination Date Format: %B %d, %Y \\"%I:%M %p\\"
4. StringPairReplacer: Replace "AM" and "PM" with "a.m." and "p.m."
  • Replacement Pairs: AM a.m. PM p.m.

Thank you very much @takashi!! Maybe it's possible for you to make some screenshots? It's much easier for me to understand. Thank you very much! :)

 


Hi @UBA_KP, if I understand your requirement correctly, this procedure might help you.

1. StringSearcher - Extract YYYYmmddHH and hours that should be added.

  • Contain Regular Expression: (\\d+)\\+(\\d+)
  • Subexpression Matches List Name: _list
2. DateTimeCalculator - Get desired datetime in the format YYYYmmddHHMMSS.
  • Mode: Add or Subtract Interval
  • Datetime: @Value(_list{0}.part)0000
  • Operator: Add
  • Hours: _list{1}.part
3. DateFormatter - Format the datetime string.
  • Source Date Format: %Y%m%d%H%M%S (or "Unknown - Automatic Detection")
  • Destination Date Format: %B %d, %Y \\"%I:%M %p\\"
4. StringPairReplacer: Replace "AM" and "PM" with "a.m." and "p.m."
  • Replacement Pairs: AM a.m. PM p.m.

Hope this helps.

 

 


Thank you very much @takashi. It seems that I've set
some parameters wrong in the transformer "DateTimeCalculator". Take a
look in the attachment please. Maybe you'll find the mistake. Thank you
again!


Thank you very much @takashi. It seems that I've set
some parameters wrong in the transformer "DateTimeCalculator". Take a
look in the attachment please. Maybe you'll find the mistake. Thank you
again!

oops , probably you are using FME 2016.1. The DateTimeCalculator shown in your screenshot is a custom transformer from FME Hub. It has been deprecated in 2017, and the same name regular transformer has been newly introduced instead.

 

In FME 2016.1, try this setting.

 

 

 


Now it seems to work, thank you very much @takashi.

But the date is not correct, please take a look in the attachment.

The file I've chosen is "HRES_ENS_2017062200+019". The result must be "June 22, 2017 “07:00 p.m.”".

When I use the data typ "date" instead of "text" in the feature writer, all fields are empty.

What can I do?


Now it seems to work, thank you very much @takashi.

But the date is not correct, please take a look in the attachment.

The file I've chosen is "HRES_ENS_2017062200+019". The result must be "June 22, 2017 “07:00 p.m.”".

When I use the data typ "date" instead of "text" in the feature writer, all fields are empty.

What can I do?

If you need to write a date/time value into a date/time type field of a destination feature type, you will have to format the date string with the Standard FME Date/Time Format (typically %Y%m%d%H%M%S) in general.

 


oops , probably you are using FME 2016.1. The DateTimeCalculator shown in your screenshot is a custom transformer from FME Hub. It has been deprecated in 2017, and the same name regular transformer has been newly introduced instead.

 

In FME 2016.1, try this setting.

 

 

 

Now it works, thank you so much @takashi.

 

 

Best regards.

 

 

Konrad

Dear FME-Users;

 

 

I’ve asked you to help me to implement the moving average into my process. I’ve done this (https://knowledge.safe.com/questions/41829/calculate-the-median-of-overlapping-pixel-values-f.html?childToView=50508#comment-50508).

 

 

Now the process can’t calculate the time anymore because the RasterBandCombiner destroys the information I need from the attribute fme_basename.

 

 

I’ve added two processing-screenshots.

 

 

Do you’ve an idea what I can do?

 

 

Thank you very much and best regards!

 

 

Konrad

Dear FME-Users;

 

 

I’ve asked you to help me to implement the moving average into my process. I’ve done this (https://knowledge.safe.com/questions/41829/calculate-the-median-of-overlapping-pixel-values-f.html?childToView=50508#comment-50508).

 

 

Now the process can’t calculate the time anymore because the RasterBandCombiner destroys the information I need from the attribute fme_basename.

 

 

I’ve added two processing-screenshots.

 

 

Do you’ve an idea what I can do?

 

 

Thank you very much and best regards!

 

 

Konrad
@takashi maybe you've an idea how to solve it? Thank your very much! :)

 


Dear FME-Users;

 

 

I’ve asked you to help me to implement the moving average into my process. I’ve done this (https://knowledge.safe.com/questions/41829/calculate-the-median-of-overlapping-pixel-values-f.html?childToView=50508#comment-50508).

 

 

Now the process can’t calculate the time anymore because the RasterBandCombiner destroys the information I need from the attribute fme_basename.

 

 

I’ve added two processing-screenshots.

 

 

Do you’ve an idea what I can do?

 

 

Thank you very much and best regards!

 

 

Konrad
There are several numbers regarding the number of rasters or bands, so I'm unclear what the source dataset is and what the destination dataset is

 

The source are 73 single band rasters for each date and the destination are 50 single band rasters for each moving average. Is it right?

 

 


There are several numbers regarding the number of rasters or bands, so I'm unclear what the source dataset is and what the destination dataset is

 

The source are 73 single band rasters for each date and the destination are 50 single band rasters for each moving average. Is it right?

 

 

I've 97 input rasters and every single raster has 1 band. After processing the moving average I've 73 rasters.

 


Dear FME-Users;

 

 

I’ve asked you to help me to implement the moving average into my process. I’ve done this (https://knowledge.safe.com/questions/41829/calculate-the-median-of-overlapping-pixel-values-f.html?childToView=50508#comment-50508).

 

 

Now the process can’t calculate the time anymore because the RasterBandCombiner destroys the information I need from the attribute fme_basename.

 

 

I’ve added two processing-screenshots.

 

 

Do you’ve an idea what I can do?

 

 

Thank you very much and best regards!

 

 

Konrad
The workflow I suggested to create moving average rasters keeps the order of the original rasters and the order (0-based sequential number) is stored in "_copynum" attribute. I therefore think that you can merge "fme_basename" of the original raster to the resulting moving average raster using an attribute representing the input order as join key. e.g.

 

 


The workflow I suggested to create moving average rasters keeps the order of the original rasters and the order (0-based sequential number) is stored in "_copynum" attribute. I therefore think that you can merge "fme_basename" of the original raster to the resulting moving average raster using an attribute representing the input order as join key. e.g.

 

 

@takashi thank you very much, but I think that I don't need the cloner. I already have 97 input raster. Do you've an idea which transformer I can use instead of cloner?

 


The workflow I suggested to create moving average rasters keeps the order of the original rasters and the order (0-based sequential number) is stored in "_copynum" attribute. I therefore think that you can merge "fme_basename" of the original raster to the resulting moving average raster using an attribute representing the input order as join key. e.g.

 

 

The workflow I suggested in this link requires to use the Cloner to create groups of single band rasters for each range of moving average.

 

Calculate the median of overlapping pixel values from 24 input raster bands

 

I don't know the actual workflow you have adopted, since there is no detailed explanation on your final solution. However, I believe that there should be a way to merge attributes including "fme_basename" of the source rasters to the moving average rasters according to the original input order, if your workflow keeps the input order. The specific way depends on the implementation of your workflow to create the moving average rasters.

 


The workflow I suggested in this link requires to use the Cloner to create groups of single band rasters for each range of moving average.

 

Calculate the median of overlapping pixel values from 24 input raster bands

 

I don't know the actual workflow you have adopted, since there is no detailed explanation on your final solution. However, I believe that there should be a way to merge attributes including "fme_basename" of the source rasters to the moving average rasters according to the original input order, if your workflow keeps the input order. The specific way depends on the implementation of your workflow to create the moving average rasters.

 

Thank you very much @takashi. Now it works! I’ve used number “-24” as “Count Start” for the Transformer “Counter”. I already wrote why my answer is so late (holiday e.g.).

 


Reply