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

Glorys output weird datetime #7

Closed
nilodna opened this issue Jun 11, 2020 · 8 comments
Closed

Glorys output weird datetime #7

nilodna opened this issue Jun 11, 2020 · 8 comments

Comments

@nilodna
Copy link

nilodna commented Jun 11, 2020

Hi @trondkr

I'm using model2roms to create initial and boundary conditions files for a ROMS simulation, using GLORYS output as a source dataset. The package is running and generating files with consistent physical patterns. However, these files have wrong and very weird datetime, with years around 3550 (slice of code below). This issue turns out to be a big problem when setting a new simulation with atmospheric forcing because dates don't match.

=========================================================================
Created INIT file
set inittime in grd.py for time-index to print (current=0)
The time stamp for ROMS .in file saved to initial file is=> 3554-11-13 00:00:00
DSTART   = 586896.0
TIME_REF = seconds since 1948-01-01 00:00:00
=========================================================================

The problem also repeats in the boundary conditions files:

=>Creating initial Boundary (BRY) file ./SWA5_bry_GLORYS_20181201_to_20181210.nc
clim2bry.py => Appending data to file ./SWA5_bry_GLORYS_20181201_to_20181210.nc for time 3554-11-13 00:00:00
Finished Thu Jun 11 01:33:43 2020

Any ideas on what is causing the weird years?

@trondkr
Copy link
Owner

trondkr commented Jun 11, 2020 via email

@nilodna
Copy link
Author

nilodna commented Jun 13, 2020

Hi @trondkr

Thank you for the suggestion. Change to "hours since 1950-01-01" doesn't work, but gave me some insights. I tried a few combinations and it happens that when I set jdref and jd as showed below, the output will have the right datetime (and everything goes well in the ROMS run with ERA5 forcing files).

In [6]: jdref = date2num(datetime(1948, 1, 1), units="seconds since 1948-01-01 00:00:00",calendar=cdf.variables["time"].calendar)                                                                                  

In [7]: jdref                                                                                                                                                                                                      
Out[7]: 0.0

In [8]: mycalendar = cdf.variables["time"].calendar                                                      

In [9]: mycalendar                                                                                       
Out[9]: 'gregorian'

In [10]: myunits = 'seconds since 1948-01-01 00:00:00'      

In [13]: currentdate = datetime(year, month, day) 

In [15]: jd = date2num(currentdate, myunits, calendar=mycalendar)                                        

In [16]: jd                                                                                              
Out[16]: 2239142400.0

However, I don't know if this solution is appropriate, because the jdref is set to zero. Is that right?

About the pull request, I'm at the early stages to adapt model2roms to work withglorys12v1. As soon as I'm sure everything is adjusted and working properly, I'll create a PR.

Best.

@trondkr
Copy link
Owner

trondkr commented Jan 21, 2021

@nilodna - did you resolve this issue and have you been able to use model2roms as you needed?

@AMIRJALA
Copy link

Hi @trondkr

I'm new in ROMS and I have a problem with the year of ROMS and your code

I get this error in the output of ROMS after adding the forcing files and running:

"MULTIFILE_INFO_S2D - Error while processing forcing multi-files:
data does not include initialization time = 2013-01-01 00:00:00.00"

in this link below, you can see my ROMS input and your code that I changed:

[https://drive.google.com/file/d/1m0xorpsoeAm80nn7JCgoUaXHFjy_oKoo/view?usp=sharing]

Thanks a lot

@trondkr
Copy link
Owner

trondkr commented Jan 28, 2021 via email

@nilodna
Copy link
Author

nilodna commented Jan 28, 2021

Hi @trondkr

Actually, I didn't have time to continue on this. I'll dig my files to see if I have some hardcoded adaptation and I can send it to you.

@AMIRJALA
Copy link

Thanks a lot for your helping @trondkr
I made it as you said but I have an error again from my log file:

NETCDF_GET_TIME_1D - error while inquiring ID for variable: srf_time
in input file: era5_msdwswrf_year_2013_roms.nc
call from: ROMS/Utility/get_cycle.F
NetCDF: Variable not found

the time from the data that downloaded from your cod is lwrad_time but the model needs srf_time!

thanks again for your response

@trondkr
Copy link
Owner

trondkr commented Apr 1, 2021

@AMIRJALA According to the code the following values are used when creating the ERA5 ROMS file:

'mean_surface_downward_short_wave_radiation_flux': {'parameter_id': 'None',
									 'short_name': 'msdwswrf',
									 'roms_name': 'swrad',
									 'name': 'Mean surface downward short-wave radiation flux',
							                 'units': 'W m-2',
							                 'time_name': 'swrad_time'}}[parameter]

So you see the time name used is swrad_time. It's possible your ROMS code expects a different time-variable name but then you have to look into your settings in the cppdefs.h and varinfo.datfiles.

Closing this as it does not seem caused by this toolbox but feel free to re-open if still an issue.

@trondkr trondkr closed this as completed Apr 1, 2021
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

3 participants