d_ecmwf2roms.m

General scientific issues regarding ROMS

Moderators: arango, robertson

Post Reply
Message
Author
Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

d_ecmwf2roms.m

#1 Unread post by Scarlett »

Hi modelers!
I'm trying to use the d_ecmwf2roms.m tool, but I've been having an error using it:
...
** Creating ROMS NetCDF forcing file: /home/ahumada/roms-3.7/matlab/forcing/forcing_inputs/gt_Qair_era.nc **

Wrote lon into record: , Min=-1.40000e+02 Max=-7.00000e+01
Wrote lat into record: , Min=-1.00000e+01 Max= 4.00000e+01

** Creating ROMS NetCDF forcing file: /home/ahumada/roms-3.7/matlab/forcing/forcing_inputs/gt_PAR_era.nc **


Error using roms_metadata (line 5166)
ROMS_METADATA: unable to find metadata for variable: PAR

Error in d_ecmwf2roms (line 364)
S.Variables(5) = roms_metadata(Vname, spherical, nctype, Unlimited);


I have already checked the file that have the PAR variable (ecmwf_era_temp_2000.nc), and it's ok...

nc{'par'} = ncshort('time', 'latitude', 'longitude'); %% 50616225 elements.
nc{'par'}.scale_factor = ncdouble(54.7914857781576);
nc{'par'}.add_offset = ncdouble(1795297.82300711);
nc{'par'}.FillValue_ = ncshort(-32767);
nc{'par'}.missing_value = ncshort(-32767);
nc{'par'}.units = ncchar(''J m**-2'');
nc{'par'}.long_name = ncchar(''Photosynthetically active radiation at the surface'');

I have downloaded this variable for other months and I still get the same error.
Could anybody help me to solve this problem?
Many thanks in advance.
-
Scarlett Mar.Mo.

jzambon
Posts: 4
Joined: Mon Sep 22, 2008 8:27 pm
Location: NC State University

Re: d_ecmwf2roms.m

#2 Unread post by jzambon »

Scarlett,

You are correct in that the issue is not with your downloaded data. Your roms_metadata.m doesn't come with PAR so d_ecmwf2roms.m doesn't know how to handle it. You need to add PAR to the variables in roms_metadata.m. The modification I made (that appears to be working for me) is as follows...

Code: Select all

diff roms_metadata.m_jbz roms_metadata.m_orig 
1581,1608d1580
<   case 'PAR'
<     V.Name                    = Vname;
<     V.Dimensions(1).Name      = 'lon';
<     V.Dimensions(1).Length    = [];
<     V.Dimensions(1).Unlimited = false;
<     V.Dimensions(2).Name      = 'lat';
<     V.Dimensions(2).Length    = [];
<     V.Dimensions(2).Unlimited = false;
<     V.Dimensions(3).Name      = 'srf_time';
<     V.Dimensions(3).Length    = [];
<     V.Dimensions(3).Unlimited = Unlimited;
<     V.Size                    = [];
<     V.Attributes(1).Name      = 'long_name';
<     V.Attributes(1).Value     = 'Photosynthetically active radiation at the surface';
<     V.Attributes(2).Name      = 'units';
<     V.Attributes(2).Value     = 'Watt meter-2';
<     V.Attributes(3).Name      = 'positive_value';
<     V.Attributes(3).Value     = 'downward flux, heating';
<     V.Attributes(4).Name      = 'negative_value';
<     V.Attributes(4).Value     = 'upward flux, cooling';
<     V.Attributes(5).Name      = 'time';
<     V.Attributes(5).Value     = 'lrf_time';
<     V.Attributes(6).Name      = 'coordinates';
<     V.Attributes(6).Value     = 'lon lat lrf_time';
<     V.Cgridtype.Name          = 'density point';
<     V.Cgridtype.Value         = 1;
<     V.Datatype                = Datatype;
<     V.ncType                  = nc_constant(nctype);
Hopefully that helps!

-Joe

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: d_ecmwf2roms.m

#3 Unread post by wilkin »

'PAR' is not a variable in the suite of forcing data used by ROMS distributed at myroms.org, so it has no entry in in the associated roms_metadata.m.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: d_ecmwf2roms.m

#4 Unread post by Scarlett »

Many thanks Joe and John!
It worked with Joe's advice (thanks Joe), but now I know is not necessary (thaks John) :wink:
-
My script worked. But I've been having problems with the dates.
I downloaded the forcing variables since ECMWF page, but it only let me download month by month.
The d_ecmwf2roms.m script don't show me any "Error" , but I see in the command window that some variables are not being created in the date that should be.
For example when I run d_ecmwf2roms.m for February (only Febrary input) I get this:
...
** Processing: swrad for 26-Feb-2001 21:00:00 **
Wrote swrad into record: 0207, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 27-Feb-2001 **
Wrote swrad into record: 0208, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 27-Feb-2001 03:00:00 **
Wrote swrad into record: 0209, Min= 0.00000e+00 Max= 4.36107e+02
** Processing: swrad for 27-Feb-2001 06:00:00 **
Wrote swrad into record: 0210, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 27-Feb-2001 09:00:00 **
Wrote swrad into record: 0211, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 27-Feb-2001 12:00:00 **
Wrote swrad into record: 0212, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 27-Feb-2001 15:00:00 **
Wrote swrad into record: 0213, Min= 0.00000e+00 Max= 5.05901e+02
** Processing: swrad for 27-Feb-2001 18:00:00 **
Wrote swrad into record: 0214, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 27-Feb-2001 21:00:00 **
Wrote swrad into record: 0215, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 28-Feb-2001 **
Wrote swrad into record: 0216, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 28-Feb-2001 03:00:00 **
Wrote swrad into record: 0217, Min= 0.00000e+00 Max= 4.32161e+02
** Processing: swrad for 28-Feb-2001 06:00:00 **
Wrote swrad into record: 0218, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 28-Feb-2001 09:00:00 **
Wrote swrad into record: 0219, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 28-Feb-2001 12:00:00 **
Wrote swrad into record: 0220, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 28-Feb-2001 15:00:00 **
Wrote swrad into record: 0221, Min= 0.00000e+00 Max= 5.04586e+02
** Processing: swrad for 28-Feb-2001 18:00:00 **
Wrote swrad into record: 0222, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 28-Feb-2001 21:00:00 **
Wrote swrad into record: 0223, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: swrad for 01-Mar-2001 **
Wrote swrad into record: 0224, Min= 0.00000e+00 Max= 0.00000e+00
** Processing: Uwind for 01-Jan-2001 **
Wrote Uwind into record: 0001, Min=-1.12991e+01 Max= 1.65393e+01
** Processing: Uwind for 01-Jan-2001 12:00:00 **
Wrote Uwind into record: 0002, Min=-1.32769e+01 Max= 1.13341e+01
** Processing: Uwind for 02-Jan-2001 **
Wrote Uwind into record: 0003, Min=-1.29289e+01 Max= 1.01099e+01
** Processing: Uwind for 02-Jan-2001 12:00:00 **
Wrote Uwind into record: 0004, Min=-1.32628e+01 Max= 1.17511e+01

...

The output forcing file for Febrary, March and the others start in January (when the input file is only for one month)


Or another problem...

** Processing: Tair for 08-Feb-2001 09:00:00 **
Wrote Tair into record: 0101, Min=-1.75995e+01 Max= 2.81982e+01
** Processing: Tair for 08-Feb-2001 15:00:00 **
Wrote Tair into record: 0102, Min=-1.48309e+01 Max= 3.06776e+01
** Processing: Tair for 08-Feb-2001 18:00:00 **
Wrote Tair into record: 0103, Min=-1.05160e+01 Max= 3.45903e+01
** Processing: Tair for 08-Feb-2001 21:00:00 **
Wrote Tair into record: 0104, Min=-9.84230e+00 Max= 3.48189e+01
** Processing: Tair for 09-Feb-2001 03:00:00 **
Wrote Tair into record: 0105, Min=-1.54309e+01 Max= 2.91678e+01
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0106, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0107, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0108, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0109, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0110, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0111, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0112, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0113, Min= 4.98535e+00 Max= 4.98535e+00
** Processing: Tair for 01-Jan-1900 **
Wrote Tair into record: 0114, Min= 4.98535e+00 Max= 4.98535e+00

...
The output forcing file write information for January 1900... (I only get this error for February and the following months)

How can I fix this problems?
Thanks in advance and Cheers.

Scarlett.
I will add my d_ecmwf2roms.m script.
Attachments
d_ecmwf2roms.m
(20.21 KiB) Downloaded 441 times

Scarlett
Posts: 48
Joined: Tue Aug 04, 2015 4:42 pm
Location: Universidad del Mar (UMAR), Mexico
Contact:

Re: d_ecmwf2roms.m

#5 Unread post by Scarlett »

Hi everybody!
I solved the last problem, the error was in my files. My internet isn't good and the download was bad, the files were damaged.
When I donwnload the files again, everything ran good.
Thanks again for your help.
-
Scarlett Mar.Mo.

User avatar
AbhiPasula
Posts: 9
Joined: Thu Dec 12, 2019 4:10 pm
Location: Indian Institute of Science

Re: d_ecmwf2roms.m

#6 Unread post by AbhiPasula »

Hi modelers,
i am new to ROMS modelling and trying to run the model using the ECMWF forcing
i have downloaded the data of 2016 entire year from ecmwf and saved in following nc files.
ecmwf_era_atms_2016.nc time, msl, tcc, v10u, v10u
ecmwf_era_flux_2016.nc time, ewss, nsss, e, tp
ecmwf_era_heat_2016.nc time, sshf, slhf, ssr, str
ecmwf_era_temp_2016.nc time, t2m, d2m, ssrd, par

I have used the d_ecmwf2roms.m code to generate following nc files.
gom_sms_era.nc
gom_shflux_era.nc
gom_swrad_era.nc
....
like that 13 nc files as mentioned in d_ecmwf2roms.m

MY Question is:
How can use these 13 .nc files to create the roms_frc.nc file which can be used as forcing.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: d_ecmwf2roms.m

#7 Unread post by kate »

You have two choices. One is to leave the files as they are and just list them all in the FRCNAME. Here is an example:

Code: Select all

    NFFILES == 14                          ! number of forcing files

    FRCNAME == /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Pair_2015.nc   |
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Pair_2016.nc   \
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Qair_2015.nc   |
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Qair_2016.nc   \
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Tair_2015.nc   |
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Tair_2016.nc   \
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_rain_2015.nc   |
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_rain_2016.nc   \
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_snow_2015.nc   |
               /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_snow_2016.nc   \
              /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_swrad_2015.nc   |
              /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_swrad_2016.nc   \
         /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_lwrad_down_2015.nc   |
         /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_lwrad_down_2016.nc   \
              /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Uwind_2015.nc   |
              /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Uwind_2016.nc   \
              /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Vwind_2015.nc   |
              /center1/AKWATERS/kate/JRA55-do/JRA55DO_1.4_Vwind_2016.nc   \
              /center1/AKWATERS/kshedstrom/CORE2/sss_fill_2004.nc         \    
              /center1/AKWATERS/kshedstrom/Arctic/Files/iron_sediment_ARCTIC4.nc \
              /center1/AKWATERS/kshedstrom/Chukchi/Files/Mineral_Fe_Flux_PI_ROMS.nc \
              /center1/AKWATERS/kshedstrom/Chukchi/Files/Soluble_Fe_Flux_PI_ROMS.nc \
              /center1/AKWATERS/kshedstrom/Chukchi/Files/MaunaLoa_CO2_1958-2018.nc
Your other choice is to use the netcdf operators (NCO) package to put them all into one file.

User avatar
AbhiPasula
Posts: 9
Joined: Thu Dec 12, 2019 4:10 pm
Location: Indian Institute of Science

Re: d_ecmwf2roms.m

#8 Unread post by AbhiPasula »

A small correction in the question,
i am using the AGRIF version,
there is no option for NFFILES in romstools_param.m
correct me if i am wrong, i think, have to give only one nc file as forcing input.

User avatar
kate
Posts: 4091
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: d_ecmwf2roms.m

#9 Unread post by kate »

Then you have to either use NCO to merge the files, use something else to merge the files, or hack that ROMS to be able to read multiple files.

User avatar
AbhiPasula
Posts: 9
Joined: Thu Dec 12, 2019 4:10 pm
Location: Indian Institute of Science

Re: d_ecmwf2roms.m

#10 Unread post by AbhiPasula »

Thank you, will try this

Rafael_Santana
Posts: 12
Joined: Wed Jun 04, 2014 1:45 pm
Location: UFBA and REMO

Re: d_ecmwf2roms.m

#11 Unread post by Rafael_Santana »

Hello everyone,

Is there a script in matlab or python to write ROMS forcing files using JRA55-do dataset?

Thanks in advance,
Rafael

User avatar
wilkin
Posts: 918
Joined: Mon Apr 28, 2003 5:44 pm
Location: Rutgers University
Contact:

Re: d_ecmwf2roms.m

#12 Unread post by wilkin »

I started down that route with a modified version of my roms_write_era5_NCARds633_frcfile.m accessing the JRA data at NCAR (https://rda.ucar.edu/datasets/ds628.0/#!access). I was having some trouble tracking down all the variables required for bulk fluxes - they are scattered through several OPeNDP end points. But it could be done.
John Wilkin: DMCS Rutgers University
71 Dudley Rd, New Brunswick, NJ 08901-8521, USA. ph: 609-630-0559 jwilkin@rutgers.edu

Rafael_Santana
Posts: 12
Joined: Wed Jun 04, 2014 1:45 pm
Location: UFBA and REMO

Re: d_ecmwf2roms.m

#13 Unread post by Rafael_Santana »

Thanks for your reply John.
I checked both your routines: roms_{get,write}_era5_NCARds633_frcfile.m. They are quite nice. Though, we have annual files of JRA55-do already download on the server.
Then I decided to modify d_ecmwf2roms.m to read and write JRA55-do variables for bulk_fluxes option. The script is attached if it is of any help.
Cheers
Attachments
write_jrado2roms.m
(19.9 KiB) Downloaded 266 times

Post Reply